Combining LET with IF

Wishmaster89

Board Regular
Joined
Jan 10, 2022
Messages
77
Office Version
  1. 2021
  2. 2019
  3. 2016
Platform
  1. Windows
  2. MacOS
Hi All

I'm trying to combine LET with IF but i'm having some trouble. It seems like when i get to the false bit of the IF, the LET statement is out of scope so i can't do a name value 2/name 2 calculation.

In column E, I currently have xlookup and if it doesn't return 0 it performs the original xlookup, which is why i want to use LET to avoid writing out the xlookup twice

This is what i have tried so far , the second function i refer to below is XLOOKUP(A6&C6,$M$2:$M$6&$O$2:$O$6,$Q$2:$Q$6))),XLOOKUP(A6&C6,$M$2:$M$6&$O$2:$O$6,$Q$2:$Q$6)

Excel Formula:
=if(let(a,xlookup(A2&B2,$M$2:$M$6&$N$2:N6,$Q$2:$Q$6))<>0,a,[B]b(2nd function)[/B],

Book2
ABCDEFGHIJKLMNOPQ
1IDStart dateCourse IDCourseGradeIDStart dateCourse IDCourseGrade
2101/03/201933MathsB215/10/202055EnglishF
3215/10/202055EnglishF428/09/202175GeographyA
4307/10/202166ITU303/06/201866ITU
5428/09/202175GeographyA101/03/201933MathsB
6701/03/202112SportsFALSE701/03/202112Sports
Sheet1
Cell Formulas
RangeFormula
E2:E6E2=IFERROR(IF(XLOOKUP(A2&B2,$M$2:$M$6&$N$2:$N$6,$Q$2:$Q$6)<>0,XLOOKUP(A2&B2,$M$2:$M$6&$N$2:$N$6,$Q$2:$Q$6,XLOOKUP(A2&C2,$M$2:$M$6&$O$2:$O$6,$Q$2:$Q$6))),XLOOKUP(A2&C2,$M$2:$M$6&$O$2:$O$6,$Q$2:$Q$6))
 
The contsruct is variable calculation, variable calculation etc & then the final formula.
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,864
Messages
6,121,986
Members
449,060
Latest member
mtsheetz

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