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
-
What if the dates are in different years?
-
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!!
-
Happy to help. 👍️
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.5K Get Help
- 424 Global Discussions
- 136 Industry Talk
- 465 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 145 Just for fun
- 63 Community Job Board
- 465 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 301 Events
- 39 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!