Use Power Query to Look Up Scores Across Multiple Excel Tables
Question details
Select the appropriate specialty table and return a score based on a revenue range.

- Product
- Microsoft Excel Power Query
- Device & OS
- not provided
- Scenario
- A workbook contains 40 structured tables with identical headers, each associated with a specialty.
- Observed behavior
- The desired result is a score from the row whose specialty and lower and upper revenue limits match the input.
Check that the source tables have consistent headers and that each table can be mapped to a specialty. Decide whether the upper revenue limit is inclusive or exclusive, and check for overlapping ranges within each specialty.
Combine the tables with Power Query and look up the score
Use one normalized table to make specialty and revenue lookups easier to maintain, even if the source tables remain separate.
The example below assumes each source table is named with the prefix tblSpec_ followed by the specialty value, such as tblSpec_Cardiology. If your names do not map directly to specialty values, create and use a separate mapping instead.
The example formula treats the lower limit as inclusive and the upper limit as exclusive. Adjust the comparison if your ranges use different boundaries.
In Excel, select Data > Get Data > From Other Sources > Blank Query. In the Power Query formula bar, enter = Excel.CurrentWorkbook() and press Enter.
Use the Name column filter to keep only table names beginning with tblSpec_. This also prevents the combined output table from being included when the query refreshes.
Select Add Column > Custom Column, name it Specialty, and enter Text.AfterDelimiter([Name], "tblSpec_"). Verify that each resulting value matches the specialty used in your lookup.
Select the expand button on the Content column and choose the lower-limit, upper-limit, and score columns. Set appropriate data types, then select Home > Close & Load. Name the resulting Excel table tblRanges in Table Design.
With the specialty in B2 and revenue in C2, enter =XLOOKUP(1,(tblRanges[Specialty]=B2)*(C2>=tblRanges[LowerLimit])*(C2<tblRanges[UpperLimit]),tblRanges[Score],"No match"). Replace the example column names with your actual headers.
Select Data > Refresh All after changing a source table or adding another table that follows the naming convention.

Work with Specialty Score Tables in WPS Spreadsheet
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface. Open compatible Excel workbooks and work with consolidated specialty and score data while moving between office suites.

Frequently Asked Questions
Can I keep the 40 source tables separate?
Yes. Power Query can combine their rows into a separate output table while leaving the source tables in place. Use Data > Refresh All after changing the sources.
How does the lookup identify the correct specialty?
The query adds a Specialty column derived from each source table name. The XLOOKUP formula compares that column with the specialty input in B2.
What happens when revenue equals an upper limit?
In the example formula, the upper limit is exclusive because it uses C2<tblRanges[UpperLimit]. Use <= instead if upper limits should be inclusive, and check that adjacent ranges do not overlap.
Why does the formula return No match?
Check that the specialty in B2 exactly matches a value in tblRanges[Specialty], that C2 is numeric, and that a row covers the revenue value. Confirm that the query was refreshed after source changes.
Will a newly added specialty table be included?
It will be included on refresh if its name begins with tblSpec_, its suffix matches the specialty value, and it has the expected columns. Select Data > Refresh All to update the combined table.




