Find the First or Last Entry in an Excel Range
Question details
The user wants formulas that return the first entry, last entry, last numeric value, or last nonblank value 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.
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.
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.
Select an empty cell and enter =OFFSET($A$1,1,0,1,1) to return the value in A2.
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 or last nonblank value in a range
Use these formulas when the range can contain gaps and you want to ignore cells that appear empty.
Find the last numeric value in a range
Use this formula when the range contains a mixture of numbers, text, and blank cells.
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. Open your workbook: Launch WPS Spreadsheets and open the workbook containing your data.
- 2. Select an output cell: Click an empty cell outside the range you want to search.
- 3. Enter the formula: Type =LOOKUP(2,1/(ISNUMBER(J4:J65536)),J4:J65536), replacing both range references with your own.
- 4. View the result: Press Enter to display the last numeric value in the selected range.

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.




