Excel MAX of Two Values: Formula and Examples

Formulas & functions · Updated November 18, 2026

To find the larger of two values in Excel, use =MAX(A1,B1), replacing A1 and B1 with the cells you want to compare. For example, if A1 contains 12 and B1 contains 19, the formula returns 19.

How the MAX formula works

MAX returns the largest numeric value among the numbers, cell references, and ranges you give it. The two cell references in the basic formula can point to any worksheet cells; they do not have to be next to each other. You can also type numbers directly into the function when you only need a quick calculation and do not need the values stored in cells.

For a quick check with the literal numbers 12 and 19, enter =MAX(12,19) in a worksheet cell. Excel returns 19. In an actual worksheet, using cell references is usually more useful: you can change either input later, and the result updates automatically when Excel recalculates.

In Microsoft 365 for Windows, select the result cell, type the formula, and press Enter. Excel for Mac and Excel for the web use the same function and formula structure. Depending on your computer’s regional settings, Excel may require semicolons instead of commas between arguments; if a formula with commas is rejected, check the list separator used by your Excel installation.

Compare two cells or a range

With the values 12 and 19 in A1 and B1 respectively, enter =MAX(A1,B1) in C1. C1 displays 19. The formula refers to the two cells as separate arguments, which is especially clear when the values are in different parts of a worksheet.

If the two values are in adjacent cells, you can refer to their range instead. With the values in A1 and B1, =MAX(A1:B1) also returns 19. The colon means “through,” so A1:B1 includes both cells. For a comparison that grows into a longer list, use a larger range: with numeric entries in A2 through A10, =MAX(A2:A10) returns the largest number in that range.

MAX can accept multiple arguments, ranges, or a combination. With numbers in A2:A10 and another number in C2, =MAX(A2:A10,C2) compares the numbers in the range as well as the value in C2. This can be convenient when one value is a separate target or adjustment rather than part of the main list.

  • Use separate arguments such as A1 and B1 when comparing a small number of individual cells.
  • Use a range such as A1:B1 for adjacent cells or a list of values.
  • Use both ranges and individual references when the values to compare are in different locations.

What happens with negatives, blanks, and text

MAX finds the numerically greatest value, not the number with the greatest absolute size. If A1 contains -8 and B1 contains -3, =MAX(A1,B1) returns -3 because -3 is greater on the number line. A common misunderstanding is to expect -8 because its magnitude is larger; that is a different calculation.

When a referenced cell is blank, MAX ignores it. With 12 in A1 and an empty B1, =MAX(A1,B1) returns 12. If both referenced cells are blank, MAX returns 0 because it has no numeric value to return. A cell containing a formula that displays an empty string is text rather than a truly empty cell, and MAX ignores that text as well.

Text and logical values in referenced cells are generally ignored by MAX, while numeric values stored as numbers are considered. Thus, if A1 contains the number 12 and B1 contains the text entry “19” stored as text, the result can be 12 rather than 19. This often happens after importing data or entering a leading apostrophe. Convert text-formatted numbers to actual numbers if they should participate in the comparison.

There is a related distinction between values in referenced cells and values typed directly as function arguments: MAX can count numbers and numeric text entered directly in the argument list, but it ignores text in cell references. For reliable worksheets, keep inputs in numeric cells rather than relying on different treatment of typed arguments.

Dates, times, and other numeric values

Excel stores dates and times as numbers, so MAX can compare them. With dates in A1 and B1, =MAX(A1,B1) returns the later date, provided both cells contain real Excel dates. If the result cell displays a number instead of a date, the calculation may still be correct: format the result cell as a date using Home > Number Format, then choose a suitable date format.

Times work similarly. If A1 contains 9:15 AM and B1 contains 11:30 AM as valid Excel times, =MAX(A1,B1) returns 11:30 AM. A time value is stored as a fraction of a day, so the displayed result depends on the cell’s number format. The function does not understand labels such as “morning” or dates typed as unrecognized text; those entries need to be converted into actual Excel values first.

MAX can also compare percentages, measurements, or currency amounts because these are numeric values with different display formats. A cell formatted as currency is still a number to the function. The format affects how the result looks, not which value MAX considers largest.

MAX compared with IF and absolute value

For the simple task of returning the larger numeric value, MAX is usually the clearest option. An IF formula can make the comparison explicitly, but it requires a condition and has a tie-handling choice. With numbers in A1 and B1, =IF(A1>=B1,A1,B1) returns the value in A1 when the values are equal; using a greater-than sign without the equals sign would return B1 in a tie. MAX returns the tied value either way, without requiring that decision.

Use IF when the result needs to depend on more than which number is larger—for example, when you want a text message, a different action for ties, or a condition that applies only in certain cases. For straightforward numeric comparison, MAX is shorter and directly communicates the purpose.

If the actual goal is to find which value has the greater magnitude, use absolute values before comparing. With -8 in A1 and 3 in B1, =MAX(ABS(A1),ABS(B1)) returns 8, the greater magnitude. That formula returns a nonnegative magnitude, not the original input value. If you need to return whichever original value has the greater magnitude, a separate conditional comparison is needed; state how ties should be handled before building it.

Common problems and how to fix them

If the result seems wrong, first confirm that the cells contain numbers rather than numbers stored as text. A green error indicator or left-aligned imported values can be clues, but formatting alone does not prove what type of value is stored. Try converting the entries to numbers and recalculate. Also check for leading or trailing spaces in imported text.

An error in one of the referenced cells can cause the MAX formula to return an error rather than a number. Inspect each input cell and resolve the underlying error if possible. If the worksheet needs a designated fallback message, you can handle errors deliberately. With values in A1 and B1, =IFERROR(MAX(A1,B1),"Check inputs") displays Check inputs when the calculation produces an error. This does not repair the source data, so use it only when replacing the visible error with a message is appropriate.

Another source of confusion is the result cell’s number format. If the formula returns a date serial but the result cell is formatted as General, or returns a decimal while the cell is formatted as a date, Excel may show an unexpected-looking display. Change the number format rather than changing the formula when the underlying comparison is correct.

  • Check that each intended value is numeric and that imported text has been converted.
  • Check whether a blank or formula-generated empty string is being ignored.
  • Look for errors in the input cells if the result is an error.
  • Review the result cell’s number format, especially for dates, times, and percentages.
  • Confirm that you want the numerically greatest value, not the greatest absolute magnitude.

Using MAX for more than two values

Although the question may involve two values, the same function scales to a whole list. For instance, with weekly totals in B2:B53, =MAX(B2:B53) returns the highest weekly total. The formula does not identify which week produced that value; it returns only the maximum number. If you also need the matching week or row, you need a lookup or another method in addition to MAX.

MAX is not the same as a conditional maximum. It compares every numeric value supplied to it and does not apply a criterion such as “only values for the East region.” In Microsoft 365 or Excel 2021, MAXIFS can return the largest value in a range that meets specified criteria. For a simple comparison of two cells, MAX is less complicated; use a criteria-based function only when the worksheet’s question requires filtering.

On Windows, formula entry and calculation work the same way in Excel for Microsoft 365 as in older desktop editions that support MAX. Excel for Mac and the web also support MAX, though interface details and regional separators can differ. The function itself does not require a newer dynamic-array feature or a special add-in.

Frequently Asked Questions

What is the formula for the maximum of two cells in Excel?

Use =MAX(A1,B1), replacing A1 and B1 with the cells you want to compare. Excel returns the larger numeric value. If the cells are adjacent, you can also use a range reference such as A1:B1.

Does MAX include zero and negative numbers?

Yes. Zero and negative numbers are numeric values, so MAX includes them. For example, when the values are -8 and -3, the maximum is -3. Zero is greater than any negative number, so it would be returned if it were one of the values being compared.

What does MAX return if both cells are blank?

When both referenced cells contain no numeric values, MAX returns 0. If one cell contains a number and the other is blank, it returns the number. Text and logical values in referenced cells are ignored.

Can MAX return the cell that contains the largest value?

No. MAX returns the largest value itself, not its address or a label from the same row. To return a name, date, or other related entry, combine the maximum calculation with an appropriate lookup approach.

Why is MAX ignoring a number in my worksheet?

The entry may be stored as text rather than as a number, which can happen with imported data or a leading apostrophe. Convert the entry to a numeric value and check for spaces or other characters. Also remember that MAX ignores text in referenced cells by design.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.