How to Standardize Data for VLOOKUP and XLOOKUP in Excel
Question details
The user needs to standardize data formats between CSV and XLSX files to ensure lookup formulas work correctly without formatting errors.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Importing and matching data from multiple file sources (CSV and XLSX) to be used as matching keys for lookup formulas.
- Observed behavior
- VLOOKUP and XLOOKUP formulas fail to find matches because the matching values come from different files with inconsistent text, number, or formatting types.
Ensure you have both the CSV and XLSX files saved locally, and identify which specific columns will serve as the matching keys for your VLOOKUP or XLOOKUP formulas.
Use Power Query to Clean and Standardize Data
Power Query is the most robust and automated method to import, clean, standardize, and combine data from multiple sources without needing complex VBA or nested formulas.
By utilizing Power Query, you can permanently solve the formatting discrepancies between CSVs and XLSX files. It allows you to convert lookup columns to uniform data types and remove hidden characters before the data ever reaches your spreadsheet.
Open Excel, go to the 'Data' tab, click on 'Get Data', and choose 'From File' to import both your CSV and XLSX files into the Power Query Editor.
In the Power Query Editor, select the lookup column, right-click the column header, select 'Change Type', and choose the exact same format (e.g., Text or Whole Number) for both datasets.
To remove hidden spaces and inconsistent characters, right-click the lookup column header again, select 'Transform', and click on 'Trim', then repeat the process and click on 'Clean'.
Once formatting is uniform, click 'Close & Load' in the top-left corner to bring the cleaned datasets into Excel, ready for error-free VLOOKUP and XLOOKUP execution.

Standardize Data and Run Lookups Seamlessly in WPS Spreadsheet
WPS Spreadsheet provides powerful built-in tools to format, clean, and consolidate data from CSV and XLSX files, ensuring your VLOOKUP and XLOOKUP formulas work perfectly without the need for complex add-ins.
- 1. Open Your Files: Launch WPS Spreadsheet and open both your CSV and XLSX files within the same workspace.
- 2. Format Data Uniformly: Highlight the lookup columns, go to the 'Data' tab, and use the 'Text to Columns' feature to convert text numbers to actual numbers or standard text formats uniformly.
- 3. Clean Inconsistent Data: Insert a helper column and use functions like =TRIM(CLEAN(A1)) to strip out any hidden spaces or non-printable characters causing mismatches.
- 4. Apply Lookup Formulas: With data standardized, use the familiar =VLOOKUP() or =XLOOKUP() functions to seamlessly link data between your sheets.

Frequently Asked Questions
Why does my VLOOKUP return #N/A even when the data looks identical?
This usually happens because of hidden spaces, non-printable characters, or mismatched data types (e.g., one value is formatted as text while the other is formatted as a number). Standardizing both datasets resolves this error.
Can I standardize data without using Power Query?
Yes. You can manually use built-in functions like TRIM(), CLEAN(), and VALUE(), or use the 'Text to Columns' feature under the Data tab to standardize text strings and numbers.
Does XLOOKUP have the same strict formatting requirements as VLOOKUP?
Yes. Although XLOOKUP is more flexible in terms of searching directions, the lookup value and the lookup array must still share the exact same data type and format to successfully match.
How do I quickly find leading or trailing spaces in my data?
You can use the LEN() formula to count the characters in a cell. If the length is longer than the visible text, you likely have hidden spaces that need to be removed using the TRIM() function.




