Can LET or LAMBDA help?

kra808

New Member
Joined
Apr 15, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
I have thousands of calculations like this..

=IF(M$2>=$C4,IF($D3=1,IF(ISNA(MATCH(M$2,Sheet6!$AE$5:$AE$29,0)),L6,XLOOKUP(M$2,Sheet6!$AE$5:$AE$29,Sheet6!$AF$5:$AF$29)*M5),IF($D3=2,IF(ISNA(MATCH(M$2,Sheet6!$AE$32:$AE$44,0)),L6,XLOOKUP(M$2,Sheet6!$AE$32:$AE$44,Sheet6!$AF$32:$AF$44)*M5),IF(ISNA(MATCH(M$2,Sheet6!$AE$47:$AE$59,0)),L6,XLOOKUP(M$2,Sheet6!$AE$47:$AE$59,Sheet6!$AF$47:$AF$59)*M5))),0).

This formula is checking logic based on many variables and is returning and calculating variables based on results of the logic. I can't seem to wrap my head around using LET or LAMBDA to help with simplicity and performance. Would using LET or LAMDA help a formula like this?

Thanks
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Why not simply remove the unnecessary functions?
As far as I can see, this should work the same, it just takes half of the effort when a match is found.
Excel Formula:
=IF(M$2>=$C4,IF($D3=1,IFERROR(XLOOKUP(M$2,Sheet6!$AE$5:$AE$29,Sheet6!$AF$5:$AF$29)*M5,L6),IF($D3=2,IFERROR(XLOOKUP(M$2,Sheet6!$AE$32:$AE$44,Sheet6!$AF$32:$AF$44)*M5,L6),IFERROR(XLOOKUP(M$2,Sheet6!$AE$47:$AE$59,Sheet6!$AF$47:$AF$59)*M5,L6))),0)
 
Upvote 0
Thanks jasonb, that works great. As you can probably tell, my Excel skills need a lot of work. Thanks again!
 
Upvote 0
Everybody has to start somewhere (y)

For information, LET is only useful if you are repeating the exact same calculation multiple times in the same cell.

I haven't received the LAMBDA update yet but from what I've read, I would say that there are too many variables with multiple lookups to make it practical.
 
Upvote 0
Thanks for the additional comments on LET and LAMBDA. I was hoping that either one would be able to handle logic with variables, but I could see how.
 
Upvote 0

Forum statistics

Threads
1,214,424
Messages
6,119,404
Members
448,893
Latest member
AtariBaby

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