Excel Formula for the Greater of Two Cells

Formulas & functions · Updated November 18, 2026

To return the larger of two cell values in Microsoft Excel, use =MAX(A2,B2). This example assumes the two values are in A2 and B2; replace those references with your own cell addresses. MAX returns the greater numeric value, or the value itself when both cells are equal.

What MAX does

MAX is Excel’s built-in function for finding the largest number among its arguments. You can give it two individual cell references, as in the opening example, or a larger collection of numbers. For a straightforward comparison between two cells, it is usually the clearest option: the formula says what you want, without needing to spell out a test and its possible outcomes.

The result is a value, not a description of which cell supplied it. If A2 contains 14 and B2 contains 21, the result is 21. If A2 contains 21 and B2 contains 14, the result is still 21. MAX does not change the source cells or identify the winning cell; it calculates a result in the cell where you entered the formula.

This is useful for comparing scores, prices, measurements, or two estimates. The same approach works in Excel for Microsoft 365 on Windows, Excel for Mac, and Excel for the web. The formula itself does not require a special setting or a newer function.

Enter the formula step by step

  1. Choose an empty cell for the answer, such as C2.
  2. For values in A2 and B2, type =MAX(A2,B2) in C2.
  3. Press Enter. C2 displays the greater numeric value.
  4. If you have more rows, use the fill handle to copy the formula down. Excel adjusts the relative references: the next row compares A3 with B3, then A4 with B4, and so on.

The result cell can be in the same row as the two inputs, which makes a comparison table easy to read. For example, headings might be “Option 1,” “Option 2,” and “Larger value.” Keep the formula in the result column rather than replacing either input, so the original values remain available for checking or later calculations.

In most regional settings, Excel uses commas between function arguments, as shown. Some installations configured for different regional conventions use semicolons as separators. If Excel rejects a formula with a comma, check the separator convention used by your installation rather than changing the function name. The formula and cell references otherwise work the same in current desktop and web versions.

How the comparison works

MAX evaluates the numeric values it receives and returns the highest one. In a formula with two references, Excel checks the contents of both referenced cells. It does not matter which cell appears first: swapping the references does not change the result. This makes MAX especially convenient when the only question is “what is the larger value?”

For example, with A2 containing 18 and B2 containing 12, the formula returns 18. With A2 containing 12 and B2 containing 18, it returns 18 again. If both contain 18, the returned value is 18. There is no separate “tie” result because the largest value is still unambiguous even if it occurs twice.

MAX returns the underlying number, not necessarily the exact way it appears on screen. A cell formatted as currency may display a currency symbol, and a date-formatted cell may display a calendar date, while Excel stores each as a numeric value. If you compare dates, the later date is the larger serial value; format the result cell as a date if you want it to look like a date rather than a number.

Examples for common comparisons

With a small table, the formula can be copied to calculate a row-by-row maximum. Assume A2:A4 contains one set of readings and B2:B4 contains a second set. In C2, use =MAX(A2,B2), then fill the formula down through C4. Each row reports the greater reading from that row’s pair. If row 2 contains 6.4 and 7.1, C2 returns 7.1; if row 3 contains 9 and 8, C3 returns 9.

For a one-off comparison of two different locations, direct references are just as suitable. With values in D5 and F5, enter =MAX(D5,F5) in the chosen result cell. You do not have to place the inputs next to each other, and you can refer to cells on another worksheet by including the sheet name in the reference. When building a cross-sheet formula, selecting the source cells with the mouse while editing can help Excel insert the correct references.

To compare more than two values, MAX can take a range. With candidate values in A2:A10, enter =MAX(A2:A10) in a separate result cell to return the largest number in that range. For exactly two cells, however, listing both references makes the comparison explicit and avoids accidentally including unrelated values between them.

Check the input layout before copying a formula. Relative references are normally what you want for parallel rows, because the references move with each copied row. If one input must remain fixed while the other changes, use an absolute reference for the fixed cell. For example, if every row should be compared with a single threshold stored in B1, place dollar signs around its column and row in the formula so that copying does not shift that reference.

When you need a comparison result, not the larger value

MAX returns the winning number, but sometimes the goal is to learn whether one cell is greater than another. A direct comparison returns TRUE or FALSE instead. With values in A2 and B2, enter =A2>B2 in another cell. It returns TRUE when A2 is greater and FALSE when A2 is equal to or less than B2. This is a logical result, not the larger value.

If you want the larger value through a conditional test, IF is another option. With the same layout—A2 and B2 holding the numbers—use =IF(A2>B2,A2,B2). Excel tests whether A2 is greater than B2; if so, it returns A2, otherwise it returns B2. This gives the maximum in ordinary numeric comparisons, but when the values tie it returns B2. MAX is simpler when ties do not need special treatment and only the value matters.

A comparison formula can also drive conditional formatting or a larger calculation, but keep the purpose clear: use MAX for a maximum value, a greater-than test for TRUE/FALSE, and IF when the result needs to depend on a condition. Choosing the right type of result makes the workbook easier for someone else to interpret.

Ties, blanks, text, and errors

If both cells contain the same number, MAX returns that number. It does not report that the values tied or say which cell should be considered the winner. If the distinction matters, use a separate comparison or add a deliberate tie rule to the worksheet. Do not assume that the order of the references makes MAX favor the first cell; it returns the maximum value, not a preferred source.

Blank cells referenced by MAX are ignored. If A2 is blank and B2 contains 7, the result is 7. If both referenced cells are blank, MAX returns 0 because it has no numeric value to return. That zero can be misleading if an empty pair should mean “no result” in your report, so consider whether blank inputs need separate handling before using the maximum in downstream calculations.

Text entries are not numbers just because they look like numbers. MAX generally ignores text and logical values supplied through cell references, so a value typed or imported as text may be skipped. If one cell contains the number 7 and the other contains text that looks like 12, the result may be 7 rather than 12. Convert or clean the source data if numeric text is unintended; changing number formatting alone does not convert text into a true numeric value.

An error in a referenced cell can make the MAX formula return an error rather than a number. Check the input cells for errors such as a failed lookup or a division-by-zero result. Also be cautious when comparing mixed data types: a numeric maximum is meaningful only when the inputs represent comparable numeric quantities. Comparing a date with a price, for example, may produce a numeric result but not a useful business answer.

Common problems and quick checks

  • The result is 0: Check whether both cells are blank, contain text rather than numbers, or have formulas that return empty text. MAX may have no numeric values to use.
  • The answer seems too small: Inspect the cell contents, not just their appearance. Imported values can be stored as text, and a currency or date format does not by itself establish that a value is numeric.
  • The formula shows as text: Make sure the result cell is not formatted as Text, and that the entry begins with an equals sign. If necessary, change the cell format to General and re-enter the formula.
  • Excel displays a formula error: Confirm the references point to the intended cells and use the argument separator expected by your regional settings. Check whether an input cell contains an error.
  • The copied formula compares the wrong cells: Review whether the references should move as the formula is filled. Use absolute references for any input that must stay fixed.

Display formatting can also create a false impression. If the underlying values are 4.46 and 4.49 but both are displayed with zero decimal places, both may appear as 4. The maximum is still 4.49, even if the result cell’s number format rounds what you see. Increase the displayed decimal places when you need to inspect the difference; formatting changes the display, not the stored value or the MAX calculation.

Frequently Asked Questions

What is the formula for the highest of two cells in Excel?
Use MAX with the two cell references. For values in A2 and B2, enter =MAX(A2,B2). It returns the larger numeric value.

Does MAX return the first cell when the values are equal?
No. MAX returns the shared maximum value and does not identify which cell it came from. If the cells tie, the numeric result is simply that tied value.

How do I show whether A2 is greater than B2?
With the values in A2 and B2, use =A2>B2. The result is TRUE if A2 is greater and FALSE otherwise, including when they are equal.

Can MAX compare cells that are not next to each other?
Yes. Reference each cell directly, such as D5 and F5, rather than selecting a range that would include cells between them. MAX can also compare a range when every value in that range should be considered.

Why does MAX return zero when the cells look empty?
MAX ignores blank references and returns zero when it finds no numeric values. A cell that appears empty may also contain text or a formula returning an empty string. Check the source cells and decide whether an empty pair should instead produce a blank or a message.

Can I use this formula in Excel for Mac or the web?
Yes. MAX and the comparison operators work in current Excel for Mac and Excel for the web as well as Excel for Microsoft 365 on Windows. The formula logic is the same; keyboard navigation and some interface details can differ, but no platform-specific version of MAX is needed.

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.