return last populated cell based on lookup conditions

buroh

New Member
Joined
Jul 14, 2020
Messages
46
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I need some help with a formula which is not working the way I want it too.

I have columns with dates and rows with values, see below:
1667476073285.png


my current formula in column M is: =IFNA(LOOKUP(2,1/((Q10:DA10<>"")*(Q10:DA10<>"Y")),Q10:DA10),"")

What it currently does is pick up the last cell in the row which is not blank, but will ignore a cell which has Y as a value.

But what I also need the formula to do is to return the value of the last populated cell of the column which has todays date or any date before todays date.

for an example the cell of row 12 column M would be blank because the last populated cell is of a date in the future.
but the value in row 10 of column N would be P01 as that is the last populated cell of todays date.

I have tried to use IF function, xlookup function but all I get is spill or error, especially because the formula doesn't like the < symbol when looking up the value e.g. <TODAY(). The IF or OR formula doesn't want to work, I am not sure what to do, any suggestions would be helpful.

Thanks,
 
Thanks for that.
Once I correct your formula to look at the correct ranges, it works for me
Fluff.xlsm
ABCDEFGHIJK
7Current RevCurrent Issue Date01/04/202201/05/202227/06/202201/08/202201/09/202230/09/202214/10/202225/11/202203/11/2022
8Stage 4Stage 2Stage 4Stage 2Stage 4Stage 4Stage 4Stage 4Stage 4
9SS44805SS
10P0144868P01
11P0244805P01P02
12  P01
13P0144682P01
14P0144774P01
15P0144868P01
16P0244805P01P02
17P0144834P01P02
18P0444848P04
Main
Cell Formulas
RangeFormula
A9:A18A9=IFNA(LOOKUP(2,1/((C9:CM9<>"")*(C9:CM9<>"Y")*(C$7:CM$7<=TODAY())),C9:CM9),"")
B9:B18B9=IFNA(IF(OR(XLOOKUP(A9,$C9:$K9,$C$7:$K$7,,0)<TODAY(),XLOOKUP(A9,$C9:$K9,$C$7:$K$7,,0)=TODAY()),XLOOKUP(A9,$C9:$K9,$C$7:$K$7,,0),""),"")
 
Upvote 0
Solution

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Thanks for that.
Once I correct your formula to look at the correct ranges, it works for me
Fluff.xlsm
ABCDEFGHIJK
7Current RevCurrent Issue Date01/04/202201/05/202227/06/202201/08/202201/09/202230/09/202214/10/202225/11/202203/11/2022
8Stage 4Stage 2Stage 4Stage 2Stage 4Stage 4Stage 4Stage 4Stage 4
9SS44805SS
10P0144868P01
11P0244805P01P02
12  P01
13P0144682P01
14P0144774P01
15P0144868P01
16P0244805P01P02
17P0144834P01P02
18P0444848P04
Main
Cell Formulas
RangeFormula
A9:A18A9=IFNA(LOOKUP(2,1/((C9:CM9<>"")*(C9:CM9<>"Y")*(C$7:CM$7<=TODAY())),C9:CM9),"")
B9:B18B9=IFNA(IF(OR(XLOOKUP(A9,$C9:$K9,$C$7:$K$7,,0)<TODAY(),XLOOKUP(A9,$C9:$K9,$C$7:$K$7,,0)=TODAY()),XLOOKUP(A9,$C9:$K9,$C$7:$K$7,,0),""),"")
Thank you, it appears I got it my ranges wrong,

yep your formula works,

many thanks,
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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