Function Problems

How to Return the Last Non-Blank Value from a Horizontal Excel Range

Aamir Naveed AkramAamir Naveed Akram Nov 10, 2026 868 views

Question details

The user wants to automatically populate a specific cell with the last non-blank value found within a designated horizontal range (e.g., G55:R55) using a formula.

How to Return the Last Non-Blank Value from a Horizontal Excel Range
Product
Excel
Device & OS
not provided
Scenario
Extracting the final piece of recorded data (like the latest monthly sales figure) from a row that may contain scattered empty cells.
Observed behavior
A dynamic formula is required to identify and display the last populated cell's content while completely ignoring any blank cells in the designated row.
Before you start

Ensure you are using a spreadsheet program or version that supports modern dynamic array functions like TAKE and TOROW (such as Microsoft 365). For older versions, alternative classic formulas will be required.

Solution 1Recommended

Use Microsoft 365 Dynamic Array Formulas (TAKE and TOROW)

Utilize the modern TAKE and TOROW functions to easily ignore blanks and extract the final value in a row.

The TOROW function is designed to convert an array or range into a single row, and it features built-in arguments to skip empty cells. By wrapping it in the TAKE function, you can effortlessly grab the very last element of the resulting array.

1
Select the Destination Cell

Click on the empty cell where you want the extracted last value to appear (for example, B6).

2
Enter the Formula

Type the formula =TAKE(TOROW(G55:R55,3),,-1). Ensure you replace 'G55:R55' with your actual target range if it differs.

3
Apply and Verify

Press Enter. The cell will calculate and instantly display the last non-blank value from your selected horizontal range.

Use Microsoft 365 Dynamic Array Formulas (TAKE and TOROW)
Understanding the Formula: The '3' in the TOROW function tells Excel to ignore both blanks and errors. The '-1' in the TAKE function instructs the formula to extract the very last item from the cleaned array.
Efficient Spreadsheet Data Management

Extract Data Easily with WPS Spreadsheet

WPS Spreadsheet provides powerful data analysis tools and comprehensive formula support, making it simple to manipulate horizontal arrays and extract exact values effortlessly.

  1. 1. Open your Workbook in WPS: Launch WPS Office and open your existing spreadsheet file containing the horizontal data.
  2. 2. Select the Destination Cell: Click on the cell where you want to output the last non-blank value.
  3. 3. Apply the Formula: Input a compatible extraction formula such as =LOOKUP(2,1/(G55:R55<>""),G55:R55) and press Enter to instantly retrieve the final value.
Fully compatible with Microsoft Excel file formats (.xlsx and .xls)Supports advanced formulas and arrays for complex data extractionLightweight, fast-loading, and entirely free to useFamiliar user interface ensuring a seamless transition and zero learning curve
microsoft office alternative - wps office

Frequently Asked Questions

Why does the TAKE and TOROW formula return a #NAME? error?

This error occurs if your version of Excel does not support dynamic array functions like TAKE and TOROW. These functions are primarily available in Microsoft 365 and newer desktop versions. For older versions, use the LOOKUP method instead.

How do I return the last value from a vertical column instead of a horizontal row?

For a vertical column, you can use a similar approach by swapping TOROW with TOCOL. The formula would be =TAKE(TOCOL(A1:A50, 3), -1) for a column range.

Does the LOOKUP formula work for both text and numbers?

Yes, the classic formula =LOOKUP(2,1/(Range<>""),Range) successfully identifies and returns the last non-blank cell regardless of whether it contains alphabetical text, symbols, or numerical data.