Function Problems

Use an Excel IF Formula to Mark the Top Two Sales Locations

Olivia MillerOlivia Miller Nov 18, 2026 868 views

Question details

The user wants an IF formula that marks locations with the two highest sales values.

Use an Excel IF Formula to Mark the Top Two Sales Locations
Product
Microsoft Excel
Device & OS
not provided
Scenario
Sales values are listed by location, and a separate column should identify the highest-ranking entries.
Observed behavior
The desired result is a Top label beside each sales value that matches the highest or second-highest value.
Before you start

Identify the sales range and an empty column for the labels. The example uses numeric sales values in G2:G8; adjust the references to match your worksheet.

Solution 1Recommended

Mark the Highest and Second-Highest Sales Values with IF

Use IF with MAX and LARGE to label rows whose sales match either of the top two values.

1
Select the first label cell

Click an empty cell in row 2, such as H2, beside the first sales value in G2.

2
Enter the formula

Type =IF(OR(G2=MAX($G$2:$G$8),G2=LARGE($G$2:$G$8,2)),"Top","") and press Enter. Replace G2:G8 with your sales range if needed.

3
Copy the formula down

Drag the fill handle from H2 through H8. Each row matching one of the top two sales values displays Top.

Mark the Highest and Second-Highest Sales Values with IF
How ties are handled: Tied values can produce more than two labels. LARGE counts duplicate values, so if the highest value occurs twice, it is also the second-highest value returned by LARGE. The range must contain at least two numeric values.
Work with sales data in WPS

Mark Top Sales Locations in WPS Spreadsheet

Use the same IF, MAX, and LARGE formula in WPS Spreadsheet to label top sales values in a workbook.

  1. 1. Open the workbook: Open WPS Spreadsheet and use Open to select your sales workbook.
  2. 2. Select a label cell: Click H2, or another empty cell beside the first sales value.
  3. 3. Enter the formula: Type =IF(OR(G2=MAX($G$2:$G$8),G2=LARGE($G$2:$G$8,2)),"Top","") and press Enter. Adjust the sales range if necessary.
  4. 4. Fill down and save: Drag the cell's fill handle down alongside the sales rows, then select Save to keep the labels.
Mark top sales values with a formula you can copy downOpen and edit Microsoft Excel XLSX and XLS filesUse familiar spreadsheet cells and formula functions
microsoft office alternative - wps office

Frequently Asked Questions

Why are more than two locations marked Top?

The formula marks every row equal to the highest or second-highest sales value. If values are tied, more than two rows can match.

Why is the third location not marked when the two highest sales values are tied?

LARGE counts duplicates. For sales of 100, 100, and 90, LARGE(range,2) returns 100, so both rows with 100 are marked and the row with 90 is not.

How do I change the formula for a different sales range?

Replace both instances of $G$2:$G$8 with your sales range and replace G2 with the first sales cell. Keep the dollar signs around the range so it stays fixed when you fill the formula down.

Why does the formula return an error?

Check that the sales range contains at least two numeric values. LARGE(range,2) returns an error if there are fewer than two numbers in the range.