Get Index from lookup of last non-blank cell

aiki100

Board Regular
Joined
Aug 16, 2016
Messages
102
Greetings -

I have tried varations of INDEX and MATCH and various LOOKUPS, but I do not seem to be able to find the correct syntax to solve my problem.
Any help would be greatly appreciated, thank you!

I have 10 columns.
In row CL1, if there is any data, the data starts in CL1 and cells to the right are populated, until they become blank.
I already have a lookup that finds the value of last non-blank cell in a row range.

=LOOKUP(2,1/(CL1:CU1<>"")*CL1:CU1)
All good - this returns the value of the last non-blank cell in the range on that row.

What I need is the index position of that last non-blank cell in the range.

For example:
I have 10 cloumns
Starting with CL1, there is data in CL1 and CM1. CN is blank.
Thus I am looking to return 2, becuase the last non-blank cell in the range is the 2nd column in the range.
If there was data in 6 contiguous cells before becoming blank on the 7th, I would want to return 6, as 6 is the last non-blank cell in the range.

How, please, can I accomplisgh this?

Also: If there is no data at all in the range, I would like to leave the cell blank (best), or at least supress the error.

Thank you all very much!
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Try this:

=IFERROR(LOOKUP(2,1/(CL1:CU1<>""),COLUMN(CL1:CU1))-COLUMN(CL1)+1,"")
 
Upvote 0
Solution
The marked solution has been switched accordingly. In your future questions, it would be great if you could mark the post that actually answered the question as it will help future readers. No further action is required for this thread.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,198
Members
452,617
Latest member
Narendra Babu D

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