Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Maximum If Excel: How to Find the Max Value with Criteria

· 7 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To find the maximum value based on specific criteria in Excel, use the MAXIFS function. The basic syntax is =MAXIFS(max_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...). This formula looks at a range of numbers and returns the largest value among the cells that meet one or more conditions you define.

Finding a maximum value is simple with the standard MAX function, but real-world data is rarely that straightforward. Usually, you need to find the highest value for a specific category—such as the highest sale for a particular employee, the maximum temperature for a specific month, or the top score for a certain grade level. The MAXIFS function allows you to filter your data dynamically without needing to manually sort your spreadsheet or use complex array formulas that can slow down your workbook.

What You'll Need

  • Microsoft Excel (Office 365, Excel 2019, or newer versions).
  • A dataset containing at least one column of numeric values (the numbers you want to find the maximum of).
  • At least one column of categorical or date-based data to serve as your criteria.

Step-by-Step

  1. Organize Your Data: Ensure your data is in a clean table format. For example, let's assume you have a table where Column A contains "Salesperson Name," Column B contains "Region," and Column C contains "Sale Amount." To make the formula easier to manage, ensure there are no empty rows or columns within your data block.
  2. Select the Output Cell: Click on the cell where you want the result to appear. It is often helpful to create a small summary table next to your main data where you list the criteria you are searching for.
  3. Start the MAXIFS Formula: Type =MAXIFS( into the cell. This opens the function and prepares Excel to receive the required arguments.
  4. Define the Max Range: The first argument is the range of cells containing the actual numbers you want to evaluate. In our example, you would highlight all the cells in Column C (e.g., C2:C100). This is the range Excel will search to find the highest number.
  5. Add a Comma: After selecting the max range, type a comma to move to the first criteria range.
  6. Define the Criteria Range: Now, select the range of cells that Excel should check for your condition. If you want to find the max sale for a specific person, highlight the "Salesperson Name" column (e.g., A2:A100).
  7. Add Another Comma: Type a comma to move to the specific criterion.
  8. Specify the Criterion: Tell Excel exactly what to look for in the criteria range. You can do this in two ways:
    • Direct Text: Type the name in quotes, such as "John".
    • Cell Reference: Click on a cell that contains the name, such as E2. Using a cell reference is highly recommended because it allows you to change the criteria without editing the formula.
  9. (Optional) Add Additional Criteria: If you need the maximum value based on multiple conditions (e.g., the highest sale for "John" specifically in the "North" region), repeat the process of adding a criteria range and a criterion. You would add a comma, select the "Region" column (B2:B100), add another comma, and then type "North" or reference a cell containing that word.
  10. Close and Enter: Type the closing parenthesis ) and press Enter. Excel will now scan the data and return the highest number that satisfies all the conditions provided.

Common Mistakes

One of the most frequent errors is mismatching the size of the ranges. In MAXIFS, the max_range and every criteria_range must be the exact same size and shape. If your max range is C2:C100 but your criteria range is A2:A50, Excel will return a #VALUE! error. Always ensure your row numbers start and end at the same point for every range mentioned in the formula.

Another common mistake is forgetting the quotation marks when entering text criteria directly into the formula. If you type =MAXIFS(C2:C100, A2:A100, John) without quotes around John, Excel will think you are referring to a named range. Since a named range called "John" likely doesn't exist, the formula will return a #NAME? error. Always use "John" or a cell reference like E2.

Users also frequently confuse MAXIFS with the older MAX function. Remember that MAX only finds the highest number in a list regardless of any other factors. If you need a condition (an "If" statement), you must use MAXIFS. If you are using a very old version of Excel (2016 or earlier), MAXIFS may not be available, leading to a #NAME? error because the function isn't recognized by the software.

Tips

To make your formulas more robust, use Excel Tables (Ctrl + T). When you convert your data range into a Table, Excel uses "Structured References" instead of cell addresses. Instead of C2:C100, your formula might look like =MAXIFS(SalesTable[Sale Amount], SalesTable[Salesperson], "John"). The primary advantage here is that as you add new rows of data to the table, the formula automatically expands to include them, meaning you never have to manually update your range references.

If you want to find the maximum value based on a numeric range (e.g., the highest sale where the quantity sold was greater than 10), you must put the logical operator in quotes. For example, the criterion would be ">10". If you want to link this to a cell (e.g., cell F2 contains the number 10), the syntax is ">"&F2. The ampersand is used to concatenate the operator with the cell value.

For those dealing with dates, remember that Excel treats dates as numbers. You can find the maximum date (the most recent date) using MAXIFS by setting a criteria range to a category and searching for the max value in the date column. This is a powerful way to find the "Last Order Date" for a specific customer.

Troubleshooting

If your MAXIFS formula is returning 0 when you know there should be a value, the most likely cause is that your criteria are not being met. Double-check for trailing spaces in your data. For example, if a cell contains "John " (with a space at the end) but your formula searches for "John", Excel will not see them as a match. You can fix this by using the TRIM function on your data to remove extra spaces.

If you receive a #VALUE! error, immediately check the dimensions of your ranges. As mentioned previously, if one range is 100 rows long and another is 99 rows long, the formula will fail. Ensure all ranges start at row 2 and end at the same final row.

If the formula returns a date that looks like a random number (e.g., 45231), the formula is working correctly, but the cell formatting is wrong. Excel stores dates as serial numbers. To fix this, right-click the cell, select "Format Cells," and choose "Date" from the Category list.

If you are using an older version of Excel that does not support MAXIFS, you can use an array formula. Type =MAX(IF(A2:A100="John", C2:C100)) and, instead of pressing Enter, press Ctrl + Shift + Enter. This tells Excel to process the IF statement as an array and then find the maximum of the resulting filtered list.

Frequently Asked Questions

Can MAXIFS handle blank cells?

Yes, MAXIFS ignores blank cells in the max range. However, if all cells that meet the criteria are blank, the function will return 0.

Is there a limit to how many criteria I can add?

You can add up to 127 pairs of criteria ranges and criteria. In practice, most users rarely need more than three or four.

Can I use wildcards in MAXIFS?

Yes, you can use a question mark (?) to match any single character or an asterisk (*) to match any sequence of characters. For example, "Jo*" would find the maximum for anyone whose name starts with "Jo".

What happens if no cells meet the criteria?

If no cells in the range meet the specified criteria, MAXIFS returns 0.

Does MAXIFS work with text in the max range?

No, the max range must contain numbers. If the max range contains text, those cells are ignored. If the entire range is text, the result will be 0.

Can I use MAXIFS to find the minimum value?

No, MAXIFS is specifically for the maximum. To find the minimum value based on criteria, use the MINIFS function, which follows the exact same syntax and logic.