IF(OR(AND formula
Hello,
I am trying to identify instances where a date has a year of 2023 and a month that is not in Q1. When I find one, I want to subtract that date from another and divide it by 365. I cannot figure out the mistake I'm making in the formula. Below is what I have and I'm getting an invalid data type error.
=IF(OR(AND(YEAR([Last Hire Date]@row) = "2023", MONTH([Last Hire Date]@row) <> "1"), AND(YEAR([Last Hire Date]@row) = "2023", MONTH([Last Hire Date]@row) <> "2"), AND(YEAR([Last Hire Date]@row) = "2023", MONTH([Last Hire Date]@row) <> "3")), ([Proration Date Reference]@row - [Last Hire Date]@row) / 365, "1")
The weird thing is I was able to get it to work correctly by searching for the YEAR = 2023 and the MONTH = 4, YEAR = 2023 and the MONTH = 5 etc but it's a longer string. I should be able to rule out what I'm not looking for as it's a shorter list.
Thank you for your help.
Best Answer
-
You can also shorten it up a bit like so:
=IF(AND(YEAR([Last Hire Date]@row) = 2023, MONTH([Last Hire Date]@row)>= 4), value_if_true, value_if_false)
Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!
Answers
-
Try removing the quotes from around the numbers.
Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!
-
You can also shorten it up a bit like so:
=IF(AND(YEAR([Last Hire Date]@row) = 2023, MONTH([Last Hire Date]@row)>= 4), value_if_true, value_if_false)
Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!
-
I used the shortened. I'm not sure why the ">=" idea never occurred to me. Thank you for an extra set of eyes and your approach!
-
Happy to help. 👍️
Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 62.8K Get Help
- 376 Global Discussions
- 207 Industry Talk
- 440 Announcements
- 4.5K Ideas & Feature Requests
- 139 Brandfolder
- 129 Just for fun
- 130 Community Job Board
- 449 Show & Tell
- 30 Member Spotlight
- 1 SmartStories
- 284 Events
- 33 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!