Return Gain or Loss from a Lookup Result in Excel
Question details
Use a lookup result to return Gain when the value is greater than 1 and Loss otherwise.

- 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.
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.
Wrap VLOOKUP in IF to classify the result
Use this formula when the matching key is in the first column of the lookup table.
In Excel, click the cell where you want to display Gain or Loss.
Type =IF(VLOOKUP(A2,Sheet2!$A$2:$J$100,10,FALSE)>1,"Gain","Loss") in the formula bar and press Enter.
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.
Drag the output cell's fill handle down to classify additional lookup values.

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. Open your workbook: Open WPS Spreadsheets and select Open to choose your Excel workbook.
- 2. Select the result cell: Click the cell where the Gain or Loss label should appear.
- 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. 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.

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.




