How to determine in Excel whether a set of data exists in another table

Using the COUNTIF, MATCH, and COUNTIFS functions, determine whether data in one or two columns appears in another sheet, returning a result of “exists” or “does not exist,” and provide step-by-step procedures for row-by-row verification along with common causes of errors.

Many people have a list—say, 30 rows of employee IDs—and want to know which ones already appear in another master sheet and which do not. Such problems are common when verifying expense reports, reconciling accounts, or identifying duplicate entries. People searching for"how to use Excel functions to check whether a set of data exists in another sheet"usually don’t need to extract the corresponding values; they just need a yes/no determination of existence.

This article is specifically devoted to addressing this issue. It does not cover how to use VLOOKUP to retrieve corresponding values; instead, it focuses on determining existence and matching data in two columns. After reading it, you can add a formula column next to one of the columns to determine, row by row, whether an entry"exists"or"does not exist."You can also compare two columns simultaneously using two criteria and identify where to look when the results are incorrect.

How do you determine whether a set of data exists in another table? One-sentence conclusion

Use COUNTIF to check whether a single column contains a specific value, and use COUNTIFS to check whether two columns match simultaneously; then simply fill the formula down to obtain results row by row. The table below provides recommended approaches based on your situation.

Your situationRecommended practiceReason
Compare only one column, such as looking only at names.COUNTIF counts the number of occurrences; if the count is greater than 0, it exists.The notation is concise and easy to understand and verify.
Compare only one column; want to use a lookup logic.MATCH plus ISNUMBERFind the return position number; if not found, return an error. ISNUMBER converts the result to TRUE or FALSE.
A match is only considered valid if both columns are identical.COUNTIFS writes two sets of criteria simultaneously.Count only when both conditions are met, to avoid misclassifying cases with the same name but different employee IDs.
Another dataset is in the PDF.First export the table to Excel, then compare.The data to be compared must be in table format; otherwise, the formulas cannot reference it.
The dataset is very large, with several thousand rows or more.Try to limit the scope; avoid citing entire columns.Full-column referencing involves heavy computation, which can easily slow down the file.

Before You Begin: First, Confirm These Points

Before you start, make sure to confirm the following points to save yourself a lot of rework.

  • Both datasets must be in tables. Formulas can only reference cell ranges. If the other dataset is in a PDF, use the PDF editor in the OmniDoc desktop client (download.omnidoc.top) to export it to Excel; if it’s a scanned document, perform OCR before exporting, and manually verify the recognition results.
  • Identify which column corresponds to"a set of data." For example, to check whether the names in Column A of List A appear in Column A of the master table, first confirm the corresponding columns on both sides; otherwise, the comparison may yield incorrect results.
  • Determine whether to match one or two columns. Use a single-column formula when comparing only names; if identical names could be duplicates, include employee IDs for a combined comparison, requiring a two-column match.
  • Check the data format. If employee IDs are numeric on one side and text on the other, they may look identical, but the formula will treat them as non-matching. Standardize the format to ensure consistency.
  • Prepare a result column. Leave a blank column next to the list to display the comparison results, keeping the original data unchanged for easy verification later.

Steps to check row by row using a formula whether a name appears in another table

Below, we take Column A of "Table 1" as the list to be checked and Column A of "Table 2" as the master list; you can replace these table names with your own worksheet names.

  1. Open the workbook containing both datasets, and confirm which column contains the list to be checked and which column contains the master list.
  2. In the first blank row next to the list to be checked (e.g., B2), enter the formula: =IF(COUNTIF(Table 2!$A:$A,A2)>0,"Exists","Does not exist").
  3. The formula means: count how many times the value in A2 appears in column A of the master list; if the count is greater than 0, return "Exists"; otherwise, return "Does not exist".
  4. Press Enter to confirm; B2 will display the result. Check whether this row matches your expectations.
  5. Double-click the fill handle at the bottom-right corner of the cell, or drag it to the end of the list to copy the formula down other rows.
  6. If you prefer using MATCH, you can modify the formula to: =IF(ISNUMBER(MATCH(A2,Table 2!$A:$A,0)),"Exists","Does not exist"). Both approaches yield the same result; choose whichever is easier for you to understand.
  7. To check for a match across two columns simultaneously—for example, if column A of the list contains names and column B contains employee IDs, while the master list has corresponding arrangements in columns A and B—the formula becomes: =IF(COUNTIFS(Table 2!$A:$A,A2,Table 2!$B:$B,B2)>0,"Match","No match").
  8. After filling in the formula, apply filtering to the results column to display only rows showing "Does not exist" or "No match"; these are the records requiring further follow-up.

Check each item one by one after completion

Just because the formula has been computed doesn't mean the result is necessarily correct; it's recommended to at least verify the following items.

Check itemHow do you see it?What should I do if there is a problem?
Is the number of results reasonable?Count how many lines there are for"exists"and"does not exist,"and see if they roughly match your estimate.If all results are"does not exist,"first check whether an incorrect column or table name has been referenced.
Is a clearly existing value being judged as non-existent?Randomly select a few rows and manually verify them in the master table using the find function.Check leading and trailing spaces, clean them using TRIM, and then compare.
Are the numbers consistent with the text?Select the cell and look at the formula bar to see if the number is left-aligned (left alignment usually indicates text).Standardize to a uniform format, then refill the formulas.
Does it contain wildcards?Check whether the data contains asterisks, question marks, or tildes.These symbols have special meanings in COUNTIF; you can escape them by preceding them with a tilde, or use MATCH instead for comparison.
Does name duplication cause misjudgments?Check rows for "existence" to see if there are duplicates.Use COUNTIFS instead, adding a second column condition, such as employee ID or department.

Note that COUNTIF and MATCH are case-insensitive by default; "abc" and "ABC" are treated as identical. If case sensitivity is required for your business logic, you will need to use an alternative approach and verify it with a small sample before deployment.

📊 Core Comparison

The three common notations each have their appropriate use cases; you can choose based on the following guidelines.

Writing styleWhat is it suitable for?Precautions
COUNTIFSingle-column existential judgment, written concisely.Sensitive to wildcards, insensitive to case
MATCH plus ISNUMBERFor single-column judgments, when understanding the lookup logicReturn an error if not found; it must be wrapped in ISNUMBER.
COUNTIFSMatches that satisfy two or more columns simultaneouslyThe more conditions, the more precise; however, with each additional set of conditions, ensure that the region size remains consistent.

If you’re only occasionally checking a few dozen lines, any of the three formats will do—just choose the one that’s easiest to read. If you plan to reuse the same set of rules repeatedly, it’s recommended to lock the formula into a template and simply replace the data each time.

❓ Frequently Asked Questions (FAQ)

1. The formula results are all "does not exist"—where did I go wrong?

In most cases, the referenced range or table name is incorrect, causing the formula to look up an empty range. First, click the reference in the formula to confirm that it points to the master table rather than the list to be searched, then check whether the data on both sides is in the same column.

2. What if the data to be analyzed is spread across multiple worksheets?

You can reference each worksheet individually in the formula and then sum the counts, for example, COUNTIF(Sheet2!A:A,A2)+COUNTIF(Sheet3!A:A,A2); if the result is greater than 0, the value exists in at least one of those sheets. When there are many worksheets, it is recommended to first consolidate the data into a single sheet before comparing, as this makes the logic clearer.

3. What should I do if there are spaces in the data and the judgment result is incorrect?

First, use the TRIM function to remove extra spaces at the beginning and end, then perform the comparison. For example, replace A2 with TRIM(A2). If spaces are located in the middle, use SUBSTITUTE to replace them, and back up the original data before making the replacement.

4. Is it possible to use a single formula to both return "exists" and display the position?

You can use MATCH to return the position number; it tells you which row the value is in the overall table. If your version of Excel supports XLOOKUP, you can achieve a similar check, but the syntax varies by version, so be sure to test it on your own version first.

5. Can the lists in scanned PDFs be compared directly?

Direct comparison is not possible. First, use OCR to convert the content into editable text and tables, export it to Excel, and then apply the formulas above. The OCR output may contain recognition errors, so before comparing, you should randomly check key rows to ensure there are no typos or missing lines.

📝 Summary

To determine whether a set of data exists in another table, the key is to select the correct columns for comparison, choose the right formula, and verify the data formats. Use COUNTIF or MATCH for single columns, and COUNTIFS when matching two columns simultaneously. If the results are unexpected, first check for leading/trailing spaces, formatting issues, and proper range references. By following these steps, you can generally resolve the issue of using Excel functions to find whether a set of data exists in another table with a single formula.

Open OmniDoc to process your spreadsheet file.

Updated 2026-11-29