How to Sort Excel Data Using a Reference List with Blank Rows
Question details
The user needs to organize data based on a specific reference list and ensure that any missing combinations from the source data appear as blank rows instead of shifting the layout.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Structuring output data to match a predetermined template or reference list, where the output must preserve the exact structure of the reference list, leaving empty spaces where data is missing.
- Observed behavior
- Without a specific formula structure, missing data is either skipped entirely or returns an error. The goal is to return a completely blank cell when a match does not exist in the source dataset.
Ensure your source dataset and reference list are on the same or accessible worksheets, and verify whether your spreadsheet software requires the use of Ctrl+Shift+Enter for array formulas.
Use INDEX, MATCH, and ISERROR Functions
This method uses a helper column and lookup functions combined with an error handler to map source data to a reference list, leaving blanks where matches fail.
By utilizing a helper column to merge criteria (like date and category), you can generate unique lookup values. The MATCH function locates the position of these values, the INDEX function retrieves the corresponding data, and the ISERROR function catches any missing items to return a clean, blank cell.
In your source data worksheet, insert a new column. Combine the primary reference values (for example, Date and Category) using the ampersand operator, such as =A2&B2. Drag this down to cover all source rows.
On your output sheet, establish your reference list exactly how you want the rows organized, including all possible dates or categories that might not exist in the source.
Use the MATCH function to look up the combined criteria from your output sheet against the helper column. Wrap it in an INDEX function to retrieve the value you need from the source data.
Wrap your INDEX and MATCH formula with an IF and ISERROR combination: =IF(ISERROR(MATCH_formula), "", INDEX_formula). This ensures that if the MATCH fails, a blank string is displayed.
In older versions of Excel, highlight the cell with your new formula, press Ctrl+Shift+Enter to confirm it as an array formula, and then drag the fill handle down and across your output area.

Sort and Organize Data Efficiently with WPS Spreadsheet
WPS Spreadsheet fully supports advanced lookup functions like INDEX, MATCH, and IFERROR, making it simple to map data to reference lists while keeping your work perfectly aligned.
- 1. Open your dataset: Launch WPS Spreadsheet and open the file containing your source data and reference template.
- 2. Add your formula: Select the first cell in your destination layout and input the =IFERROR(INDEX(...), "") formula to look up your data.
- 3. Fill the series: Press Enter, then click and drag the small square at the bottom-right of the cell to copy the formula across your template seamlessly.

Frequently Asked Questions
How do I sort data using a custom list without formulas?
You can use the 'Custom Sort' feature. Select your data, navigate to the Data tab, click Sort, select your column, and choose 'Custom List' from the Order dropdown. However, this method simply rearranges existing data and will not insert blank rows for missing values.
Why does my MATCH function return a #N/A error?
The #N/A error occurs when the MATCH function cannot find the exact lookup value in your reference array. This is completely normal for missing data. Wrapping your formula in IFERROR() or IF(ISERROR()) converts this error into a blank space.
Can I use XLOOKUP instead of INDEX and MATCH for this task?
Yes. If you are using a recent version of Excel or WPS Spreadsheet, XLOOKUP is an excellent alternative. It features a built-in 'if_not_found' argument, allowing you to simply type "" to return a blank row if a combination is missing.
Why do I need to press Ctrl+Shift+Enter for some formulas?
In older versions of Excel, combining multiple criteria into a single lookup operation relies on array calculations. Pressing Ctrl+Shift+Enter tells the software to evaluate the formula as an array, indicating this by automatically adding curly braces {} around the formula.




