Lookup a Column based on Unique ID and last transaction (date)

smalik

Board Regular
Joined
Oct 26, 2006
Messages
186
Office Version
  1. 365
Platform
  1. Windows
I posted this earlier but I can't find it under my posts. Therefore, please forgive me if this is a duplicate request.

I am trying to fill in the Address field from a transaction file. A unique ID can have multiple transactions. Each transaction comes with an Address. I need to pull the address from the latest transaction based on the date. In case the address is missing from the last transaction, can I pull the data from the transaction before? Obviously, if the ID in Column A does not find any transaction record, I need the cell to stay blank.

Looking to complete Column B using data in Columns D through F. The results I need are highlighted in tan color.

1691704841919.png


PS: I downloaded the Xl2BB add-in but MS Excel blocked the macro saying that the source could not be verified. Did I miss a step?

Thanks for your help in advance.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
How about:

In cell B3:
Excel Formula:
=LET(d,D3:D17,e,E3:E17,f,F3:F17,BYROW(A3:A6,LAMBDA(br,FILTER(f,(d=br)*(e=MAX((d=br)*(f<>"")*(e))),""))))
 
Upvote 0
@DanteAmor

The above formula works very well for small range. However, I am getting into a range limitation issue.

Here is the range for my data set:
Columns D, E, & F the data goes down to row 62,129
Column A goes down to row 17,654

The formula works until certain rows. After that I get an error message:
=LET(d,D3:D62000,e,E3:E62000,f,F3:F62000,BYROW(A3:A133,LAMBDA(br,FILTER(f,(d=br)*(e=MAX((d=br)*(f<>"")*(e))),""))))
This formula (range) gives me no error and provides the results I am looking for

Anything after 62,000 I get the #n/a error
=LET(d,D3:D62050,e,E3:E62050,f,F3:F62050,BYROW(A3:A135,LAMBDA(br,FILTER(f,(d=br)*(e=MAX((d=br)*(f<>"")*(e))),""))))
This formula (range) gives me #N/A error

However, for column "A" range anything over 133 gives me a #CALC! error.
=LET(d,D3:D62000,e,E3:E62000,f,F3:F62000,BYROW(A3:A134,LAMBDA(br,FILTER(f,(d=br)*(e=MAX((d=br)*(f<>"")*(e))),""))))
This formula (range) gives me #CALC! error

Any idea how should I deal with his issue?

Any help is greatly appreciated.

Regards,
 
Upvote 0
How about
Excel Formula:
=BYROW(A2:A236,LAMBDA(br,TAKE(SORT(FILTER(E2:F63000,(D2:D63000=br)*(F2:F63000<>""),""),1,-1),1,-1)))
 
Upvote 0
Solution
How about
Excel Formula:
=BYROW(A2:A236,LAMBDA(br,TAKE(SORT(FILTER(E2:F63000,(D2:D63000=br)*(F2:F63000<>""),""),1,-1),1,-1)))
Hello @Fluff ,

Thanks for revising the formula. However, I am getting an "#N/A" Error now:

BTW, the Column A range should go down to 17,654. I tried changing the range for Column A, but I get the either zero or "#N/A" error.

Any thoughts?

1693265546826.png
 
Upvote 0
Check that you don't have any #N/A errors in columns D, E & F
 
Upvote 0
@Fluff

Never mind... I found it... there was one #N/A record.
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

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