How to compare two lists in Excel: COUNTIF, XLOOKUP and conditional formatting
Compare two lists in Excel: who is present and who is missing, what is new, which prices changed — using COUNTIF, XLOOKUP and conditional formatting, plus common traps.
HR has staff lists for October and November. The question: who left and who joined? A warehouse checks an order against the delivery, an accountant matches a bank statement against the books, a manager compares an old and a new price list. The logic is always the same: does each value from the first list exist in the second?
Searching by eye fails even at 20 rows. Below are three methods: flag with a formula, pull the value and compute the difference, and highlight with color.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | October | Status | November | Status | ||
| 2 | Aziz Karimov | Stayed | Dilnoza Rakhimova | Existing | ||
| 3 | Dilnoza Rakhimova | Stayed | Aziz Karimov | Existing | ||
| 4 | Javokhir Turaev | Left | Sardor Aliev | Existing | ||
| 5 | Malika Yusupova | Left | Bekzod Usmonov | New | ||
| 6 | Sardor Aliev | Stayed | Nodira Saidova | Existing | ||
| 7 | Nodira Saidova | Stayed | Shakhzoda Kodirova | New | ||
| 8 |
Method 1: COUNTIF — “is it there or not?”
1
Type =СЧЁТЕСЛИ($D$2:$D$7;A2) in B2. The result is how many times Aziz Karimov appears in the November list: 1 means present, 0 means missing.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | October | Count | November | ||
| 2 | Aziz Karimov | 11 | Dilnoza Rakhimova | ||
| 3 | Dilnoza Rakhimova | Aziz Karimov | |||
| 4 | Javokhir Turaev | Sardor Aliev | |||
| 5 | Malika Yusupova | Bekzod Usmonov | |||
| 6 | Sardor Aliev | Nodira Saidova | |||
| 7 | Nodira Saidova | Shakhzoda Kodirova | |||
| 8 |
2
Always lock the second list’s range with $ (F4). Otherwise it slides down as you fill, and the last rows are checked against only part of the list.
3
Turn the number into a word: =ЕСЛИ(СЧЁТЕСЛИ($D$2:$D$7;A2)>0;"Stayed";"Left") and fill down. For the other direction (who is new?), put the same formula in E2 looking at column A: =ЕСЛИ(СЧЁТЕСЛИ($A$2:$A$7;D2)>0;"Existing";"New").
4
Turn on the filter (Ctrl + Shift + L) and keep only “Left” in column B — your list is ready.
Method 2: XLOOKUP — pull the value and see the difference
1
When you need the value itself, not just yes/no — say, our price versus a supplier’s new price list. Type =ПРОСМОТРX(A2;$E$2:$E$5;$F$2:$F$5;"None") in C2: if the product is in the price list you get its price, otherwise “None”.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Product | Ours | Price list | Diff | List item | Price | |
| 2 | Sugar | 14 000 | 14 500 | 500 | Flour | 420 000 | |
| 3 | Flour | 420 000 | 420 000 | 0 | Sugar | 14 500 | |
| 4 | Oil | 22 000 | None | — | Rice | 18 000 | |
| 5 | Rice | 17 000 | 18 000 | 1 000 | Pasta | 9 000 | |
| 6 |
2
Put the difference in D2: =ЕСЛИ(C2="None";"—";C2-B2). A positive number means the price rose, 0 means no change, “—” means the product dropped off the list.
3
XLOOKUP is available in Excel 2021/365. In older versions: =ЕСЛИОШИБКА(ВПР(A2;$E$2:$F$5;2;ЛОЖЬ);"None"). To check presence only: =ЕЧИСЛО(ПОИСКПОЗ(A2;$E$2:$E$5;0)) → TRUE/FALSE.
Method 3: conditional formatting — show the difference in color
1
Select the October list (A2:A7). Главная → Условное форматирование → New Rule...
| A | B | C | D | |
|---|---|---|---|---|
| 1 | October | November | ||
| 2 | Aziz Karimov | Dilnoza Rakhimova | ||
| 3 | Dilnoza Rakhimova | Aziz Karimov | ||
| 4 | Javokhir Turaev | Sardor Aliev | ||
| 5 | Malika Yusupova | Bekzod Usmonov | ||
| 6 |
2
Choose Use a formula to determine which cells to format and enter =СЧЁТЕСЛИ($C$2:$C$7;A2)=0. A2 is the first cell of the selection, without $. Use Формат to pick a red fill.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | October | November | ||
| 2 | Aziz Karimov | Dilnoza Rakhimova | ||
| 3 | Dilnoza Rakhimova | Aziz Karimov | ||
| 4 | Javokhir Turaev | Sardor Aliev | ||
| 5 |
3
Click OK — names missing from November turn red. The color is live: change a list and the highlighting updates by itself.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | October | November | ||
| 2 | Aziz Karimov | Dilnoza Rakhimova | ||
| 3 | Dilnoza Rakhimova | Aziz Karimov | ||
| 4 | Javokhir Turaev | Sardor Aliev | ||
| 5 | Malika Yusupova | Bekzod Usmonov | ||
| 6 | Sardor Aliev | Nodira Saidova | ||
| 7 | Nodira Saidova | Shakhzoda Kodirova | ||
| 8 |
Pro level: get the list of differences with one formula
- Only those who left (Excel 365):
=ФИЛЬТР(A2:A7;СЧЁТЕСЛИ(D2:D7;A2:A7)=0)— the result spills down, no filter needed. - Compare on two columns (e.g. name and position must both match):
=СЧЁТЕСЛИМН($D$2:$D$7;A2;$E$2:$E$7;B2). - Present in both lists: select both ranges with Ctrl → Условное форматирование → Highlight Cells Rules → Duplicate Values. If neither list has internal repeats, the colored cells are the common ones.
- Row-by-row comparison (two columns in the same order):
=A2=B2or=СОВПАД(A2;B2). UI way: select both columns and press Ctrl + \ — Excel selects the cells that differ (Go To Special → Row Differences).
Try it in the simulator
Type =ЕСЛИ(СЧЁТЕСЛИ($C$2:$C$7;A2)>0;"Stayed";"Left") in B2 and fill down to B7. Then type =ЕСЛИ(СЧЁТЕСЛИ($A$2:$A$7;C2)=0;"New";"") in D2 to find who joined in November.
| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | October | Status | November | New? | ||||||||||||||||||||
| 2 | Aziz Karimov | Dilnoza Rakhimova | ||||||||||||||||||||||
| 3 | Dilnoza Rakhimova | Aziz Karimov | ||||||||||||||||||||||
| 4 | Javokhir Turaev | Sardor Aliev | ||||||||||||||||||||||
| 5 | Malika Yusupova | Bekzod Usmonov | ||||||||||||||||||||||
| 6 | Sardor Aliev | Nodira Saidova | ||||||||||||||||||||||
| 7 | Nodira Saidova | Shakhzoda Kodirova | ||||||||||||||||||||||
| 8 | ||||||||||||||||||||||||
| 9 | ||||||||||||||||||||||||
| 10 | ||||||||||||||||||||||||
| 11 |
Has ExcelLab been useful?
Support the project and help us release new lessons and exercises.