Use Excel LOOKUP to Return the Rightmost Nonblank Value
Question details
Find the rightmost nonblank value in a row that may contain blank cells.

- 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.
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.
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.
In Excel, click an empty cell outside D45:N45 where you want the result to appear.
In the formula bar, enter =IFERROR(LOOKUP(2,1/(D45:N45<>""),D45:N45),"") and press Enter.
If your data is not in D45:N45, edit the formula and replace both instances of D45:N45 with your row range.

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. Open your spreadsheet: Open WPS Spreadsheet and select File > Open to choose your workbook.
- 2. Choose a result cell: Click an empty cell outside the range you want to search.
- 3. Enter the formula: Type =IFERROR(LOOKUP(2,1/(D45:N45<>""),D45:N45),"") in the formula bar and press Enter.
- 4. Update the references: Replace both D45:N45 references with your own row range, then save the workbook using File > Save.

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.




