How to Calculate and Compare Weekly Peak Values in Excel
Question details
The user needs a formula to calculate the difference between daily recorded amounts and the highest amount recorded for the matching week.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Tracking daily entries categorized by weeks and analyzing how each day's entry compares to that specific week's maximum value.
- Observed behavior
- The user needs to implement a dynamic formula that correctly identifies the weekly peak and calculates the variance while accommodating newly added rows.
Ensure your dataset is properly organized with dedicated columns for the 'Week' identifier and the daily 'Amount'. It is highly recommended to convert your data range into an Excel Table (Ctrl+T) first, so your formula ranges automatically expand when new daily rows are added.
Use the MAXIFS Function to Calculate Peak Variance
The MAXIFS function is the most efficient way to find a conditional maximum value and compare it directly within the same row.
The MAXIFS function allows you to find the highest value in a specified range that meets certain criteria—in this case, matching the week number or label. By subtracting this peak value from the current row's amount, you obtain the exact variance.
Click on the first empty cell in your 'Weekly Peak Variance' column (for example, cell E2).
Type the formula =$D2-MAXIFS($D$2:$D$1000,$A$2:$A$1000,$A2) into the formula bar. Assume Column D contains the Amounts and Column A contains the Week identifiers.
Press Enter to execute the calculation. Then, click and drag the fill handle (the small square at the bottom-right corner of the cell) down to apply the formula to all rows in your dataset.

Use an Array Formula (For Older Excel Versions)
If you are using an older version of Excel that does not support the MAXIFS function, you can use a combination of MAX and IF as an array formula.
Calculate Weekly Peak Values Easily in WPS Spreadsheet
WPS Spreadsheet fully supports advanced mathematical and conditional functions like MAXIFS, allowing you to track and analyze daily or weekly variances effortlessly. It is a lightweight alternative that perfectly handles complex data calculations.
- 1. Open your dataset: Launch WPS Spreadsheet and open the workbook containing your daily amounts and week labels.
- 2. Input the MAXIFS formula: Select the target variance cell and input the formula =$D2-MAXIFS($D$2:$D$1000,$A$2:$A$1000,$A2).
- 3. Calculate the variance: Press Enter to instantly calculate the difference from the weekly peak.
- 4. Fill the formula down: Drag the fill handle at the bottom right of the cell to apply the calculation to the rest of the column dynamically.

Frequently Asked Questions
Why is my MAXIFS formula returning a #NAME? error?
The #NAME? error typically occurs if you are using an older version of Excel (like Excel 2016 or earlier) that does not support the MAXIFS function. To fix this, you must either upgrade your software or use the MAX(IF()) array formula alternative.
How can I make my MAXIFS formula update automatically when I add new daily rows?
To make formulas automatically expand, you should convert your data into an Excel Table. Select any cell within your data and press Ctrl+T. Then, rewrite your formula using structured references (for example: =[@Amount]-MAXIFS([Amount],[Week],[@Week])). The ranges will automatically adjust when new data is pasted below.
Can I automatically highlight the highest weekly amount instead of calculating variance?
Yes, you can use Conditional Formatting to highlight peaks. Select your Amount column, navigate to Conditional Formatting > New Rule > Use a formula to determine which cells to format, and enter the formula =$D2=MAXIFS($D$2:$D$1000,$A$2:$A$1000,$A2). Set your preferred fill color, and it will highlight the maximum value for each week.




