How to Reference Values from Merged Cells in Excel Formulas
Question details
The user needs to reference data contained within a merged cell range in formulas, but only the first cell returns a value while the rest return blank.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Calculating totals or looking up data using functions like SUMIFS or VLOOKUP based on categories that are vertically grouped using merged cells.
- Observed behavior
- Formulas referencing the merged range fail for all rows except the first one because only the upper-left cell of a merged block contains the data, leaving the rest empty.
Before applying formulas, evaluate if merged cells are strictly necessary for your data table layout, as unmerging cells and repeating labels is often the cleanest approach for data analysis and prevents formula errors.
Use a Helper Column with an IF Formula
Create a new column to automatically fill down the category values from the merged cells, which can then be used reliably in your calculation formulas.
When cells are vertically merged, Excel only stores the actual data in the top-left cell of the merged range. Subsequent underlying cells are treated as blank, which breaks lookup and aggregation functions.
A helper column bypasses this limitation by using a logical IF function to conditionally copy the category name down to every row.
Insert a new column directly next to your merged category column. For example, insert Column D to act as the helper for the merged Category Column A.
In the first data row of the helper column (e.g., cell D2), reference the top-left cell of your merged data directly by typing `=A2`.
In the next row down (e.g., cell D3), enter the formula `=IF(A3="",D2,A3)`. This tells the spreadsheet to check if the adjacent cell is blank (which happens if it is part of a merge) and pulls the value from the row above if true.
Select cell D3 and drag the fill handle down to copy this formula to the rest of your data rows. The column will now display the category name for every single row.
Modify your primary calculation formulas, such as VLOOKUP or SUMIFS, to reference this new helper column instead of the original merged column.

Unmerge Cells and Fill Blanks
Remove the merged formatting entirely and populate every cell with the appropriate category name for better data management.
Fix Merged Cell Formula Errors Easily with WPS Spreadsheet
WPS Spreadsheet provides a robust and highly compatible environment for data analysis, supporting all standard Excel formulas, including IF, VLOOKUP, and SUMIFS. Handle complex data formatting and merged cell calculations seamlessly.
- 1. Open your workbook: Launch WPS Spreadsheet and open the document containing your merged data.
- 2. Insert helper column: Right-click the column header next to your merged data and choose 'Insert Column'.
- 3. Apply IF logic: Use the IF function logic (e.g., `=IF(A3="",D2,A3)`) to populate the blank underlying cells automatically.
- 4. Calculate accurately: Apply your final SUMIFS or lookup formulas referencing the newly created continuous data column.

Frequently Asked Questions
Why do formulas return zero or error when pointing to a merged cell?
When multiple cells are merged, the spreadsheet software only retains the value in the uppermost-left cell of that range. All other underlying cells are cleared and become empty. Therefore, any formula referencing rows below the first row of the merge will read a blank or zero value.
Can I use VLOOKUP directly on vertically merged cells?
Generally, no. VLOOKUP expects a solid value in every row it scans. If it searches for a match or tries to return a value from a row that falls within the 'blank' portion of a merged range, it will fail. You must use a helper column or unmerge the cells to make it work.
Is there a way to merge cells but keep data in all of them?
Standard cell merging always clears data from the secondary cells. If you want the visual appearance of horizontally merged cells without breaking the data structure, you can use 'Center Across Selection' in the Format Cells alignment options. However, this feature does not apply to vertical merging.




