logo
search
Function Problems

How to Count Unique Part Numbers Across Multiple Columns in Excel

Algirdas JasaitisAlgirdas Jasaitis Sep 27, 2026 869 views

Question details

The user needs to extract a unique list of part numbers from a data range spanning multiple columns and calculate the occurrence frequency of each distinct part number.

How to Count Unique Part Numbers Across Multiple Columns in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
Analyzing inventory or product logs where part numbers are scattered across different rows and columns, requiring a summary of distinct items and their totals.
Observed behavior
The goal is to flatten a multi-column range, remove duplicate part numbers, and return the aggregated count of each item in a neat two-column layout.
Before you start

Ensure your Excel version supports Dynamic Array functions like LET, TOCOL, and UNIQUE, which are available in Microsoft 365 and Excel 2021 or later.

Solution 1Recommended

Use LET, TOCOL, and UNIQUE for Dynamic Array Counting

This dynamic array formula flattens the multi-column data, extracts unique values, and calculates the count in a single step.

This method is highly efficient as it does not require helper columns. It combines several modern Excel functions to process the data range directly.

1
Select a Destination Cell

Click on an empty cell where you want the two-column result (Part Number and Count) to begin spilling.

2
Enter the Formula

Type the formula `=LET(d, H1:K100, v, UNIQUE(TOCOL(d, 1)), w, COUNTIF(d, v), HSTACK(v, w))` into the formula bar. Replace 'H1:K100' with your actual data range.

3
Execute the Formula

Press Enter. The formula will automatically spill the unique part numbers into the first column and their respective counts into the adjacent column.

Use LET, TOCOL, and UNIQUE for Dynamic Array Counting
Formula Breakdown: TOCOL(d,1) flattens the array and ignores blanks. UNIQUE extracts the distinct items. COUNTIF counts the occurrences in the original range, and HSTACK joins the results side-by-side.

Analyze Multi-Column Data Effortlessly with WPS Spreadsheet

WPS Office Spreadsheet provides excellent support for dynamic array functions and advanced data analysis tools, allowing you to easily tally inventory and unique part numbers.

  1. 1. Open Your Inventory File: Launch WPS Spreadsheet and open the document containing your multi-column part numbers.
  2. 2. Extract Unique Values: Select a blank cell and use the `=UNIQUE()` function combined with your range to generate a distinct list of parts.
  3. 3. Count the Frequencies: In the adjacent column, use the `=COUNTIF(Original_Range, Unique_Cell)` formula to calculate how many times each part number appears.
  4. 4. Drag to Fill: Drag the fill handle down to apply the count formula to all the unique part numbers.
Fully compatible with Microsoft Excel formulas and .xlsx file formats.Supports advanced data summarization techniques like UNIQUE and COUNTIF.Free, lightweight, and features a familiar tabbed interface for seamless transition.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my formula return a #NAME? error?

This error occurs if your version of Excel does not support modern dynamic array functions like LET, TOCOL, or UNIQUE. You will need Microsoft 365 or Excel 2021 (or later) to use them. For older versions, you can use Pivot Tables or complex traditional array formulas.

Does the TOCOL function ignore blank cells?

Yes, when you set the second argument of the TOCOL function to 1 (e.g., TOCOL(H1:K100, 1)), it automatically ignores any empty cells within the specified range.

How do I sort the results by the highest count?

You can wrap the entire formula in a SORT function. For example, using `=SORT(LET(...), 2, -1)` will sort the output based on the second column (the counts) in descending order.

Can I count part numbers using older Excel versions?

Yes, but it is more tedious. You can press Alt + D + P to open the legacy PivotTable Wizard, select 'Multiple consolidation ranges', and create a Pivot Table that flattens and counts the data across multiple columns.