Function Problems

Return Gain or Loss from a Lookup Result in Excel

Aamir Naveed AkramAamir Naveed Akram Nov 18, 2026 869 views

Question details

Use a lookup result to return Gain when the value is greater than 1 and Loss otherwise.

Return Gain or Loss from a Lookup Result in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A user wants to classify a value returned from the tenth column of a lookup table.
Observed behavior
The formula should display Gain for a returned value greater than 1 and Loss for a value of 1 or less.
Before you start

Identify the lookup value and a table whose first column contains the matching keys and whose tenth column contains numeric values. Make sure the table range includes all ten columns.

Solution 1Recommended

Wrap VLOOKUP in IF to classify the result

Use this formula when the matching key is in the first column of the lookup table.

1
Select an output cell

In Excel, click the cell where you want to display Gain or Loss.

2
Enter the formula

Type =IF(VLOOKUP(A2,Sheet2!$A$2:$J$100,10,FALSE)>1,"Gain","Loss") in the formula bar and press Enter.

3
Adjust the references

Replace A2 with your lookup-value cell and Sheet2!$A$2:$J$100 with your table range. Keep 10 as the column index if the result is in the tenth column of that range.

4
Apply it to other rows

Drag the output cell's fill handle down to classify additional lookup values.

Wrap VLOOKUP in IF to classify the result
Values equal to 1: The formula returns Loss when the lookup result equals 1. If no exact match is found, VLOOKUP returns #N/A instead of Gain or Loss.
Calculate lookup results in WPS

Classify lookup results in WPS Spreadsheets

Use IF and VLOOKUP in WPS Spreadsheets to label a returned value as Gain or Loss, then fill the formula down for other rows.

  1. 1. Open your workbook: Open WPS Spreadsheets and select Open to choose your Excel workbook.
  2. 2. Select the result cell: Click the cell where the Gain or Loss label should appear.
  3. 3. Enter the formula: In the formula bar, enter =IF(VLOOKUP(A2,Sheet2!$A$2:$J$100,10,FALSE)>1,"Gain","Loss") and press Enter.
  4. 4. Update and fill: Replace the example cell and table references with your own, then drag the cell's fill handle down to apply the formula to other rows.
Classify tenth-column lookup values with a single formulaOpen and edit Microsoft Excel XLSX and XLS filesFill the formula down to process multiple recordsUse a familiar spreadsheet interface
microsoft office alternative - wps office

Frequently Asked Questions

What happens if the lookup result is exactly 1?

The formula returns Loss because the test is strictly greater than 1. Change >1 to >=1 in the formula bar if 1 should count as Gain.

Why does the formula return #N/A?

VLOOKUP returns #N/A when it cannot find an exact match in the first column of the selected table range. Check the lookup value and the table range in the formula bar.

Can I display a message instead of a lookup error?

Yes. Wrap the formula in IFERROR, for example: =IFERROR(IF(VLOOKUP(A2,Sheet2!$A$2:$J$100,10,FALSE)>1,"Gain","Loss"),"Check lookup"). This message replaces any formula error, not just missing matches.

Can I use XLOOKUP instead of VLOOKUP?

Yes, in Excel versions that support XLOOKUP. For example, use =IF(XLOOKUP(A2,Sheet2!A2:A100,Sheet2!J2:J100)>1,"Gain","Loss") and adjust the lookup and return ranges to match your data.