Find value to left

jamescooper

Well-known Member
Joined
Sep 8, 2014
Messages
834
This formula finds the last non-blank value in a row, how do I find the value to the left of it (same row)?

VBA Code:
=LOOKUP(2,1/(NOT(ISBLANK($O5:$XFD5))),$O5:$XFD5)

Many thanks.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Try:

Excel Formula:
=INDEX($O$5:$XFD$5,MAX((ISBLANK($O$5:$XFD$5)=FALSE)*(COLUMN($O$5:$XFD$5)-COLUMN(O5)+1))-1)

Mr excel questions 63.xlsm
OPQRSTU
1
2
3311
4
5732771476311292
6
7
8
jamescooper
Cell Formulas
RangeFormula
O3O3=INDEX($O$5:$XFD$5,MAX((ISBLANK($O$5:$XFD$5)=FALSE)*(COLUMN($O$5:$XFD$5)-COLUMN(O5)+1))-1)


But, what do you want if the penultimate cell is blank? The above formula will return a zero.

This may be more easily done in 365 or 2021, Which version do you have? (You should update your profile so your version shows up on your posting button.
 
Last edited:
Upvote 0
Thanks that works I don't think it will be blank but if it could be, would probably need a variation of the formula?
 
Upvote 0
If you want to take a penultimate blank into consideration please tell me what version of excel you use, and update your profile button. The non 365/2021 version will be more difficult to create.
 
Upvote 0
See if the following formula works for you (Excel 2010 and newer):
Excel Formula:
=INDEX(5:5,AGGREGATE(14,6,COLUMN($O5:$XFD5)/($O5:$XFD5<>""),2))
 
Last edited:
Upvote 0
Here is a 365 solution, I'm sure there are others as well.
Excel Formula:
=LET(
nbrs,FILTER($O$5:$XFD$5,$O$5:$XFD$5<>""),
nnbrs,COUNTA(nbrs),
CHOOSECOLS(nbrs,nnbrs-1))
 
Upvote 0
Microsoft 365

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Another option
Excel Formula:
=choosecols(filter(O5:XFD5,O5:XFD5<>""),-2)
 
Upvote 0

Forum statistics

Threads
1,215,403
Messages
6,124,714
Members
449,182
Latest member
mrlanc20

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