First and last cell in a column

phoebian

New Member
Joined
Feb 18, 2021
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
Hi all,

I am looking for 2 similar formulas which provide the following:

Formula 1: The data from the first none empty cell in a column
Formula 2: The data from the last none empty cell in a column

I found the following which provides the first: =INDEX(A2:A7,MATCH(TRUE,F:F<>"",0))
But I am unable to turn it around to show the last value.

The spreadsheet is large so needs to be efficient in its calculations.
The first few cells may be empty.
I was hoping both formulas would be of a similar function (IE, both using =INDEX, or =VLOOKUP).

So in the example table below, formula 1 should result in 1 or 2 (depending on which column we run it on), and formula 2 should result in 5 or 6 (depending on which column we run it on)

Odd NumbersEven numbers
1
2
3
4
5
6

THANKS!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

jtakw

Well-known Member
Joined
Jun 29, 2014
Messages
6,007
Office Version
  1. 2016
Platform
  1. Windows
Hi,

For the last value in column, assuming you mean Numbers and not Text:

Book3.xlsx
ABCDE
1Odd NumbersEven numbersFor AFor B
2156
3256
43
54
65
76
Sheet778
Cell Formulas
RangeFormula
D2:E2D2=LOOKUP(1,1/A2:A10,A2:A10)
D3:E3D3=LOOKUP(9.99999999999999E+307,A2:A10)
 
Solution

phoebian

New Member
Joined
Feb 18, 2021
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
Thanks; yes I think this will only be numeric values so it looks good.

Is there a similar way to use =LOOKUP(1,1/A2:A10,A2:A10) for the first column with a value? I have OCD.
 

jtakw

Well-known Member
Joined
Jun 29, 2014
Messages
6,007
Office Version
  1. 2016
Platform
  1. Windows
You're welcome, thanks for the feedback.

I'm afraid the INDEX/MATCH formula you're using is the best way to get the First value in column (although I believe your F:F reference should be A2:A7)...

We could use a VLOOKUP, for the 1st value, but Only if it's Text.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,407
Messages
5,641,955
Members
417,249
Latest member
serrulate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top