Forum Discussion
Tony2021
Nov 26, 2022Iron Contributor
Formula to return a date within a range of dates
Hello Experts, I have a table with a payment date in column A. I need to return a date found in a named range "Conversion" if that conversion date is in the same quarter that the payment date is...
- Nov 26, 2022
Hi Tony, please use XLOOKUP().
I have combined year and quarter for the correct result.
=XLOOKUP(YEAR([@[Payment Date]])*10+ROUNDUP(MONTH([@[Payment Date]])/3,0),ROUNDUP(YEAR(Table2[Conversion])*10+MONTH(Table2[Conversion])/3,0),Table2[Conversion],"",1)
dscheikey
Nov 26, 2022Bronze Contributor
Hi Tony, please use XLOOKUP().
I have combined year and quarter for the correct result.
=XLOOKUP(YEAR([@[Payment Date]])*10+ROUNDUP(MONTH([@[Payment Date]])/3,0),ROUNDUP(YEAR(Table2[Conversion])*10+MONTH(Table2[Conversion])/3,0),Table2[Conversion],"",1)
- Tony2021Nov 26, 2022Iron Contributorthats amazing. thank you for the response.
I have a follow up though.
I am now backtracking a bit since I notice that the missing quarter was an overlook on my part. I now see that the Q1 2023 is present.
How could the formula be modified to return "" instead of the next quarter? I studied the formula but it way out of my league.
thank you very much.- dscheikeyNov 26, 2022Bronze Contributor
You only have to delete the 5th parameter. The default here is the exact search. You can simply remove the parameter ",1".
=XLOOKUP(YEAR([@[Payment Date]])*10+ROUNDUP(MONTH([@[Payment Date]])/3,0),ROUNDUP(YEAR(Table2[Conversion])*10+MONTH(Table2[Conversion])/3,0),Table2[Conversion],"")- Tony2021Nov 27, 2022Iron Contributorworked perfectly! thank you very much for the help!