Referencing merged cells from unmerged rows in Excel often yields frustrating blank values, disrupting your reporting flow. When tracking complex financial models-especially those evaluating standard funding sources like venture capital or traditional loans-maintaining data integrity is critical. Fortunately, mastering dynamic lookup formulas grants analysts seamless data continuity across mismatched sheet structures.
The Stipulation: Excel strictly stores a merged range's value in its top-left anchor cell (e.g., cell A2 in a merged A2:A5 group). For concrete examples like project budgeting, formulas must dynamically target this specific anchor.
Below, we explore the precise formulas, such as LOOKUP and SCAN, to automate this retrieval process.
Merged cells are a popular formatting choice in Microsoft Excel. They allow you to create clean, visually appealing headers and group related rows under a single label. However, while merged cells look great on a presentation slide or a printed report, they are a notorious nightmare for data analysis, sorting, filtering, and writing formulas.
If you have ever tried to reference a merged cell from an unmerged row, you have likely encountered the frustrating issue where Excel returns a 0 or a blank value. This happens because of how Excel stores data behind the scenes. Fortunately, there are several clever formulas and techniques you can use to bypass this limitation. In this guide, we will explore the underlying problem and walk through multiple solutions-ranging from classic formulas to modern Excel 365 dynamic array solutions.
To understand why a simple cell reference fails, we must first look at how Excel treats merged cells. When you select a range of cells (for example, A2:A5) and click "Merge & Center," Excel does not actually distribute the value across all those cells. Instead, it places the value in the top-left cell of the range (in this case, A2) and leaves the remaining cells (A3, A4, and A5) completely blank.
Visually, it looks like a single large cell containing your value. But systemically, the grid looks like this:
| Cell Address | Visual Appearance | Actual Value Stored |
|---|---|---|
| A2 | North Region | "North Region" |
| A3 | Blank (0) | |
| A4 | Blank (0) | |
| A5 | Blank (0) |
If you write a formula in an unmerged row next to cell A4 and try to reference it using =A4, Excel looks at the underlying grid, sees that A4 is empty, and returns a blank or a zero. To get the value "North Region" for row 4, your formula needs to dynamically "look upward" and find the last non-empty cell in column A.
If you are working on an older version of Excel (Excel 2019, 2016, or earlier), or if you need your workbook to be highly backward-compatible, the classic LOOKUP formula is your best option. This approach relies on a clever quirk in how Excel's vector-form LOOKUP function handles approximate matches.
=LOOKUP(2, 1/($A$2:A2<>""), $A$2:A2)
B2, enter the formula above.This formula might look like black magic at first glance, but it is highly logical once broken down:
$A$2:A2<>"": This creates an array of logical values (TRUE or FALSE) indicating whether the cells in the expanding range are not empty. For row 4, this range is $A$2:A4, which evaluates to {TRUE, FALSE, FALSE}.1/(...): We divide 1 by this logical array. In Excel, TRUE is treated as 1, and FALSE is treated as 0. Therefore, 1/TRUE equals 1, and 1/FALSE results in a division by zero error (#DIV/0!). The array now looks like this: {1, #DIV/0!, #DIV/0!}.LOOKUP(2, ...): Excel's LOOKUP function is designed to search for a value in an array. If it cannot find an exact match, and the lookup value (2) is greater than any value in the array (the highest value in our array is 1), it ignores the error values and matches the last numeric value in the array.$A$2:A2, which is "North Region".If you are using Excel for Microsoft 365 or Excel 2021, you have access to dynamic arrays and lambda helper functions. These functions allow you to write cleaner, more efficient formulas that can spill down an entire column automatically, eliminating the need to drag formulas down manually.
The SCAN function is perfectly suited for this task because it can accumulate and carry over a value from one row to the next.
=SCAN("", A2:A15, LAMBDA(prev, curr, IF(curr="", prev, curr)))
B2).SCAN formula into that single cell.A2:A15).The SCAN function processes an array row-by-row and keeps a running "accumulator" value:
"": This is the initial value of our accumulator (starting as blank).A2:A15: This is the range of merged cells we want to scan.LAMBDA(prev, curr, ...): This defines a custom operation where prev represents the value carried over from the previous row, and curr represents the value of the current cell.IF(curr="", prev, curr): This is the core logic. If the current cell is blank (which is true for all rows in a merged block except the first one), it uses the previous row's value (prev). If the current cell contains a value, it updates the accumulator with this new value (curr).If you prefer to avoid complex array formulas or new lambda functions, you can achieve the exact same result using a simple helper column with basic IF logic.
B2, write a simple reference to the first merged cell:
=A2
B3, enter the following logical formula:
=IF(A3<>"", A3, B2)
B3 down to the bottom of your dataset.This formula checks if the current cell in column A has a value. If it does, it uses that value. If it is blank (because it is part of a merged cell range), it copies the value from the helper cell directly above it (B2). This creates a waterfall effect that seamlessly fills in all the blanks.
Once populated, you can hide Column B, or copy the values and paste them as "Values" elsewhere in your workbook to lock them in.
While formulas can bridge the gap, maintaining merged cells in a raw data table is generally discouraged by database administrators and advanced Excel users. If you are preparing data for a Pivot Table, a chart, or complex calculations, the best practice is to unmerge the cells and fill the empty spaces with duplicate values.
You can do this in seconds without writing a single formula:
=) and press the Up Arrow key on your keyboard. This writes a formula referencing the cell above (e.g., =A2).Referencing merged cells doesn't have to break your Excel models. By using the classic LOOKUP formula, the modern SCAN function, or helper columns, you can cleanly pull values from unmerged rows without destroying the formatting of your spreadsheet. However, when working with large datasets destined for further analysis, unmerging your cells and filling down the blank values remains the gold standard for data hygiene.
Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.