# How to use another cell's value if a cell is blank in Excel

Test the cell and fall back to the other one: =IF(C2="",B2,C2).

**Excel:** `=IF(C2="",B2,C2)` (Every current version)

**Google Sheets:** the same formula works.

## Example

Sample data (row 1 is the header):

| A | B | C | D |
| --- | --- | --- | --- |
| Customer | Billing city | Shipping city | Ship to |
| Kim | Austin |  |  |
| Raj | Denver | Boulder |  |
| Lee | Tampa |  |  |
| Ola | Fargo | Bismarck |  |
| Max | Boise |  |  |

Formula in D2, filled to D6: `=IF(C2="",B2,C2)`

Result: Austin; Boulder; Tampa; Bismarck; Boise

## How it works

When the shipping city is empty, IF returns the billing city; otherwise it keeps the shipping city. It is the spreadsheet version of "use this, or fall back to that".

## Other ways

- `=IF(C2<>"",C2,B2)`: The same rule, testing for a value first.
- `=IF(LEN(TRIM(C2))=0,B2,C2)`: Also treats a cell that holds only spaces as empty.

## Common mistakes

- A cell holding a space isn't empty, so the fallback doesn't kick in and the result looks blank. The TRIM version handles it.
- Returning a blank cell directly (`=C2`) shows 0 in Excel, which is why the blank test comes first.

## Questions

**How do I take the first filled cell of several?**

Chain the tests, `=IF(C2<>"",C2,IF(B2<>"",B2,"No city"))`, or in Excel 365 use `=XLOOKUP(TRUE,B2:C2<>"",B2:C2,"")`.

**How do I fill blanks with the value above?**

In a helper column B: `=IF(A2="",B1,A2)`, filled down, repeats the last value.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/use-another-cell-if-blank
