Forum Discussion

ShamsM's avatar
ShamsM
Copper Contributor
Dec 19, 2025

Using a combination of IF Statement and LET function

Hello,

I am trying to do the following from the attached link:

  • If the Fiscal period date in Col B (of the SORTED_INV_CN worksheet) is greater than/equal to Dec 2025 or less than April 2025 then type in "Ignore"
  • Else, use the LET function to lookup by Invoice# in the LookUp-Comment worksheet

However, the function in Cell D2 of the SORTED_INV_CN worksheet is returning "Ignore" for all the rows in Column D. At the end of the day, I am required to evaluate the xlookup function for date range less than Dec 2025 and April 2025. I am partial to the LET function as it reduces the need to add a 2nd xlookup formula. The LET function works without the parent IF function but is returning erroneous data as soon as I incorporate the IF(OR( function.

 

Here is the link to the file: 

https://docs.google.com/spreadsheets/d/1oiWWXXOSorZuB5Q4vzgdHO_kyRkvGE3L/edit?usp=drive_link&ouid=103354753371375324640&rtpof=true&sd=true

 

I think the problem lies in the way the date format is being interpreted between the evaluation cells.  Hope you can point me in the right direction. Thank you.

Regards,

Shams.

1 Reply

  • Harun24HR's avatar
    Harun24HR
    Bronze Contributor

    Do you mean date range to ignore or just those two dates? To ignore two date range try-

    =IF(AND(A2>=$G$3,A2<=$G$2),"Ignore",LET(x,"Your formula here",x))

    To ignore only those two date, try-

    =IF(OR(A2=$G$2,A2=$G$3),"Ignore",LET(x,"Your formula here",x))

     

Resources