Function Problems

Use Excel LOOKUP to Return the Rightmost Nonblank Value

Steven ParkerSteven Parker Nov 22, 2026 868 views

Question details

Find the rightmost nonblank value in a row that may contain blank cells.

Return the Rightmost Nonblank Value in an Excel Row
Product
Microsoft Excel
Device & OS
not provided
Scenario
A row contains values and blank cells, and the user wants a formula that returns the last populated value from a specified range.
Observed behavior
The desired result is the value in the rightmost nonblank cell, or an empty string if the entire range is blank.
Before you start

Identify the row range to search and choose a result cell outside that range. The example uses D45:N45; replace both references if your data is elsewhere.

Solution 1Recommended

Use LOOKUP and IFERROR to Find the Rightmost Value

Use this formula when a row contains gaps and you want the last nonblank value without calculating a column number.

1
Select a result cell

In Excel, click an empty cell outside D45:N45 where you want the result to appear.

2
Enter the formula

In the formula bar, enter =IFERROR(LOOKUP(2,1/(D45:N45<>""),D45:N45),"") and press Enter.

3
Adjust the range

If your data is not in D45:N45, edit the formula and replace both instances of D45:N45 with your row range.

Use LOOKUP and IFERROR to Find the Rightmost Value
How the formula works: LOOKUP finds the last matching nonblank cell in the range. IFERROR returns an empty string if the range is entirely blank. The result is rightmost by position, not necessarily the most recent by date.
Work with spreadsheet formulas

Find the Rightmost Nonblank Value in WPS Spreadsheet

Use the same LOOKUP and IFERROR formula in WPS Spreadsheet to return the last nonblank value in a row.

  1. 1. Open your spreadsheet: Open WPS Spreadsheet and select File > Open to choose your workbook.
  2. 2. Choose a result cell: Click an empty cell outside the range you want to search.
  3. 3. Enter the formula: Type =IFERROR(LOOKUP(2,1/(D45:N45<>""),D45:N45),"") in the formula bar and press Enter.
  4. 4. Update the references: Replace both D45:N45 references with your own row range, then save the workbook using File > Save.
Find the rightmost populated cell even when a row contains gapsOpen and edit Microsoft Excel XLSX filesUse a familiar spreadsheet interfaceWork with spreadsheet formulas in a free office suite
QA img-9

Frequently Asked Questions

What happens if every cell in the range is blank?

IFERROR returns an empty string, so the formula cell appears blank.

Does the formula treat zero as a blank?

No. A cell containing 0 is nonblank, so the formula can return it if it is the rightmost nonblank value.

Will a formula that returns an empty string count as blank?

No. The comparison D45:N45<>"" excludes cells whose formulas return an empty string.

How do I search a different row or range?

Edit the formula in the formula bar and replace both instances of D45:N45 with the range you want to search.

Does this formula find the latest date?

It finds the rightmost nonblank value by position. It returns the latest date only if the latest date is also the rightmost nonblank value.