How to Use Excel VLOOKUP to Match Data Only on the First Occurrence
Question details
The user needs an Excel formula to return matching data from another sheet only for the first instance of a duplicate value, leaving subsequent duplicate rows blank.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Matching grouped geographic area data across two sheets where the main lookup column contains multiple repeated identifiers.
- Observed behavior
- A standard VLOOKUP formula populates the matched data for every duplicate instance, rather than showing the result only once per unique identifier.
Identify the column containing your duplicate lookup values (e.g., Column C) and ensure your destination data range on the second sheet is properly formatted.
Use IF and COUNTIF combined with VLOOKUP
Wrap your VLOOKUP inside an IF function that checks an expanding COUNTIF range. This ensures the lookup result is displayed only when the count of the value is exactly 1.
By default, VLOOKUP returns a match for every instance of a lookup value. To prevent data from repeating down a column, you can use a mixed reference in a COUNTIF function to create a running count. When the running count equals 1, the VLOOKUP executes; otherwise, the formula returns a blank cell.
Click on the cell where you want the first matched result to appear (e.g., cell G2 on Sheet1).
Type the formula: =IF(COUNTIF($C$2:$C2,$C2)=1,VLOOKUP($C2,Sheet2!$C$2:$F$5,COLUMN(B1),FALSE),"") into the formula bar.
Press Enter to execute the formula. Then, click and drag the fill handle at the bottom-right corner of the cell to copy the formula down the column and across rows as needed.

Use XLOOKUP with IF and COUNTIF
For newer versions of Excel, XLOOKUP provides a robust alternative to VLOOKUP while still utilizing the same COUNTIF logic to filter out duplicate returns.
Easily Manage Advanced Formulas in WPS Spreadsheet
WPS Spreadsheet fully supports complex nested functions like VLOOKUP, IF, XLOOKUP, and COUNTIF. You can effortlessly manage large datasets, filter duplicate values, and match cross-sheet data without any performance lag.
- 1. Open your workbook: Launch WPS Spreadsheet and open the file containing your geographic data.
- 2. Enter the nested formula: Select the target cell and input the exact =IF(COUNTIF(...), VLOOKUP(...), "") formula as you would in Microsoft Excel.
- 3. Drag to fill: Use the fill handle to apply the formula down your column to instantly process all 502 geographic areas effortlessly.

Frequently Asked Questions
Why does a standard VLOOKUP return duplicate results?
By default, VLOOKUP searches for the lookup value from top to bottom and returns the first match it finds. If you drag a standard VLOOKUP formula down a column containing duplicate lookup values, it simply repeats that same first matched result for every instance.
How does the COUNTIF part of the formula work?
The formula =COUNTIF($C$2:$C2,$C2) relies on an expanding reference range. The first part of the range ($C$2) is absolute (locked), while the second part ($C2) is relative. As you drag the formula down to row 3, it becomes $C$2:$C3, creating a running count of occurrences up to the current row.
Can I use INDEX and MATCH instead of VLOOKUP?
Yes. You can replace the VLOOKUP portion with an INDEX and MATCH structure to achieve the same result. The formula structure would look like: =IF(COUNTIF($C$2:$C2,$C2)=1, INDEX(Sheet2!$D$2:$D$5, MATCH($C2, Sheet2!$C$2:$C$5, 0)), "").




