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.9K Get Help
- 441 Global Discussions
- 139 Industry Talk
- 471 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 496 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!