Yield year if criteria is between two dates in two columns.

Hello,
I am trying to yield the Year if Start date is greater than or equal to 1/1/2023 but pre-marketing date is less than or equal to 12/31/2023.
I was fine with a simple year in a single column but am stumped with yielding year between two dates in two columns.
Thanks!
Best Answer
-
You can nest an IF function inside of the YEAR function to choose which date to output.
=IF([Pre-Marketing Date]@row <> "", [Pre-Marketing Date]@row, [Start Date]@row)
Now that we have the IF outputting the date we want to use, we wrap the whole thing in a YEAR function.
=YEAR(IF([Pre-Marketing Date]@row <> "", [Pre-Marketing Date]@row, [Start Date]@row))
Answers
-
-
Very good question and I'm not thinking this through properly. With the example above, sometimes the pre-marketing field is not filled out, but start date is. Default should always be pre-market date but if pre-market date isn't filled out, then start date should be used. Is this even possible?
-
You can nest an IF function inside of the YEAR function to choose which date to output.
=IF([Pre-Marketing Date]@row <> "", [Pre-Marketing Date]@row, [Start Date]@row)
Now that we have the IF outputting the date we want to use, we wrap the whole thing in a YEAR function.
=YEAR(IF([Pre-Marketing Date]@row <> "", [Pre-Marketing Date]@row, [Start Date]@row))
-
Hey! Thanks for the assist here. This formula is yielding an invalid data type, but is pulling the data correctly. Thoughts?
-
Hey nevermind! I wrapped it in IFERROR and it worked. Thank you so much!!
-
Help Article Resources
Categories
Check out the Formula Handbook template!