invalid data type
I keep getting "invalid data type" with this formula:
=INDEX(COLLECT({Time Audit Overview %Accurate}, {Time Audit Overview start date}, AND(YEAR({Time Audit Overview start date}) = 2024, MONTH({Time Audit Overview start date}) = 12), {Time Audit Overview restaurant}, [Restaurant Name]@row), 1)
I have checked that my "start date" column is a date column, and the "{Time Audit Overview restaurant}" and "[Restaurant Name]" columns are the same column type.
Anyone have ideas on what else could be giving me the "invalid data type" error?
Answers
-
Try this:
=INDEX(COLLECT({Time Audit Overview %Accurate}, {Time Audit Overview start date}, AND(IFERROR(YEAR(@cell), 0) = 2024, IFERROR(MONTH(@cell), 0) = 12), {Time Audit Overview restaurant}, [Restaurant Name]@row), 1)
-
PAUL! Thank you so much! That worked! Would you be willing to explain in simple terms how that piece (the date piece specifically) is working just to build my knowledge? I put it into AI to explain it but it just gave me what I already knew.
-
There are two parts to my update.
First is using @cell references. This tells the function to evaluate the previously established range on a cell by cell basis.
Second is the IFERROR. If there is a blank cell in the date column, the YEAR and MONTH functions will throw an error. Using the IFERROR function allows us to replace that error with whatever we want. I use zero because I know that there will never be a year or month zero.
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.8K Get Help
- 439 Global Discussions
- 138 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 67 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!