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

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,884
Hi geversud

EDIT: My formulas imploded after barry posted his.


PGC
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061

ADVERTISEMENT

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?
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
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)
 

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,696

ADVERTISEMENT

Maybe...

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

Hope this helps!
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
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" :)
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
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.
 

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,696
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. :)
 

Forum statistics

Threads
1,136,366
Messages
5,675,351
Members
419,563
Latest member
blairtab

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