Use an Excel IF Formula to Mark the Top Two Sales Locations
Question details
The user wants an IF formula that marks locations with the two highest sales values.

- 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.
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.
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.
Click an empty cell in row 2, such as H2, beside the first sales value in G2.
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.
Drag the fill handle from H2 through H8. Each row matching one of the top two sales values displays Top.

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. Open the workbook: Open WPS Spreadsheet and use Open to select your sales workbook.
- 2. Select a label cell: Click H2, or another empty cell beside the first sales value.
- 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. Fill down and save: Drag the cell's fill handle down alongside the sales rows, then select Save to keep the labels.

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.




