Function Problems

Find the First or Last Entry in an Excel Range

Elise WilliamsElise Williams Nov 22, 2026 868 views

Question details

The user wants formulas that return the first entry, last entry, last numeric value, or last nonblank value in an Excel range.

Find the First or Last Entry in an Excel Range
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet contains a list or range from which a specific first or last value needs to be returned.
Observed behavior
The desired result is a formula that returns the appropriate value for the contents and layout of the range.
Before you start

Identify the cells that contain your data and whether the range has gaps, formulas returning empty strings, or a header. Replace the example cell references with your own range, and enter each formula outside that range.

Solution 1Recommended

Find the first and last entries in a contiguous list

Use these formulas when A1 is a header and the entries start in A2 without gaps.

The last-entry formula counts all nonempty cells in column A, so the column must contain only the header and the contiguous list, with at least one entry below the header.

1
Return the first entry

Select an empty cell and enter =OFFSET($A$1,1,0,1,1) to return the value in A2.

2
Return the last entry

Select another empty cell and enter =OFFSET($A$1,COUNTA(A:A)-1,0,1,1) to return the last entry in the list.

Find the first and last entries in a contiguous list
Check for gaps: If the list has gaps or column A contains unrelated values, use the nonblank-range formulas instead.
WPS Spreadsheets

Find the last numeric entry with WPS Spreadsheets

Use a LOOKUP formula in WPS Spreadsheets to return the last numeric value in a range while skipping text and blank cells.

  1. 1. Open your workbook: Launch WPS Spreadsheets and open the workbook containing your data.
  2. 2. Select an output cell: Click an empty cell outside the range you want to search.
  3. 3. Enter the formula: Type =LOOKUP(2,1/(ISNUMBER(J4:J65536)),J4:J65536), replacing both range references with your own.
  4. 4. View the result: Press Enter to display the last numeric value in the selected range.
Find the last numeric entry with a single formulaOpen and edit Microsoft Excel XLSX and XLS filesWork with spreadsheet formulas in a familiar interface
microsoft office alternative - wps office

Frequently Asked Questions

Why does the last-entry formula return the wrong row?

The COUNTA and OFFSET formula assumes a header in A1, a contiguous list starting in A2, and no unrelated values in column A. If there are gaps, use =LOOKUP(2,1/(A2:A65536<>""),A2:A65536) instead.

How do I find the last number and ignore text?

Enter =LOOKUP(2,1/(ISNUMBER(J4:J65536)),J4:J65536) in an empty cell. Change both references to the range you want to search.

Do the nonblank formulas count cells that contain an empty string?

No. The comparison A2:A65536<>"" treats cells containing formulas that return an empty string as blank.

Why does my formula return #N/A?

The lookup formulas return #N/A when the range contains no matching value. Check that the range includes at least one nonblank or numeric value, depending on the formula.