Last non-empty cell in a row function

geversud

Board Regular
Joined
Jul 17, 2002
Messages
181
What is the best way to return the contents of the last empty cell in a row in a worksheet function?

e.g. If I have a function in Column A, then I want the function in Column A to identify the last column that has data in it and return its contents. It needs to be dynamic because columns are constantly being added.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Ok, I've used this formula before that Barry Houdini came up with here. But what I need to do now is modify the range it looks in to skip collumns.

Say range is a1:f1
I want it only to look in collumns A C and D.

Example data

Fail | Date | Fail | Date | Pass | Date

I need to return the the Pass/Fail REsult furthest to the right.

Can anyone help?
 
Upvote 0
What values are in pass/fail?

Assuming they are relatively low numbers and that the dates are relatively high numbers, i.e. if they are recent dates above 10000, then perhaps

=LOOKUP(2,1/((A1:F1<10000)*(A1:F1<>"")),A1:F1)
 
Upvote 0
Maybe...

=LOOKUP(REPT("z",255),A1:F1)

Hope this helps!
 
Upvote 0
Domenic,

Yes, I think you've read that right - I was assuming some sort of percentage in the pass/fail cells not literally "pass"/"fail". Of course I hope the date cells don't literally contain "date" :)
 
Upvote 0
Right, sorry wasn't more clear.

Pass / Fail is litteraly the words Pass or Fail
And dates are dates 10/20/2006. 10/26/2006 etc..

Thanks for the response, I'll give it a try and let you know how it works.
 
Upvote 0
Domenic,

Yes, I think you've read that right - I was assuming some sort of percentage in the pass/fail cells not literally "pass"/"fail". Of course I hope the date cells don't literally contain "date" :)

After seeing your solution, I thought that maybe I had read it wrong. But I let my solution stand, figuring one of us had to be right. :)
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,952
Members
448,535
Latest member
alrossman

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
Back
Top