Function Problems

How to Use Excel VLOOKUP to Match Data Only on the First Occurrence

John WilsonJohn Wilson Oct 28, 2026 868 views

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.

How to Use Excel VLOOKUP to Match Data Only on the First Occurrence
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.
Before you start

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.

Solution 1Recommended

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.

1
Select the target cell

Click on the cell where you want the first matched result to appear (e.g., cell G2 on Sheet1).

2
Enter the nested formula

Type the formula: =IF(COUNTIF($C$2:$C2,$C2)=1,VLOOKUP($C2,Sheet2!$C$2:$F$5,COLUMN(B1),FALSE),"") into the formula bar.

3
Apply and drag

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 IF and COUNTIF combined with VLOOKUP
Understanding the Expanding Range: The COUNTIF range $C$2:$C2 uses a locked starting cell ($C$2) and a relative ending cell ($C2). As you drag it down, it expands (e.g., $C$2:$C3), accurately counting how many times a value has appeared up to that current row.
Seamless Formula Execution

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. 1. Open your workbook: Launch WPS Spreadsheet and open the file containing your geographic data.
  2. 2. Enter the nested formula: Select the target cell and input the exact =IF(COUNTIF(...), VLOOKUP(...), "") formula as you would in Microsoft Excel.
  3. 3. Drag to fill: Use the fill handle to apply the formula down your column to instantly process all 502 geographic areas effortlessly.
100% compatible with Microsoft Excel (.xlsx) files and formulas.Free to use with a lightweight and fast installation.Familiar user interface for seamless formula entry and data analysis.
microsoft office alternative - wps office

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)), "").