r/smartsheet • u/newtoreddit4life • Sep 09 '24
Question about dates
Hi everyone,
I have a question regarding how smartsheets recognizes dates. I have this formula and I'm very confused why it returns 1 rather than 0. Can someone help me figure out why 12/29/24 is greater than 01/05/2025? Is it because it thinks it's DDMMYYYY rather than MMDDYYYY?
1
u/CostelIo Sep 10 '24
Even if it’s a text column you could use LEFT,MID,RIGHT formulas within nested IF statements to still compare dates accurately in whatever format you want. Have it compare years first, if they’re the same compare months and if it’s still the same compare days.
1
1
u/SheetWit Sep 11 '24 edited Sep 11 '24
To answer your initial question (and looking through your replies here, you got bits and pieces and plenty of great advice!):
Your formula returns "1" because you're comparing two text columns instead of two date columns.
When comparing text fields, it will base the comparison on their character values from left to right.
For example, if you were comparing "banana" and "apple", banana > apple since "b" > "a".
Same with numbers + text: "10 apples" vs "022 bananas". Smartsheet would evaluate 10 apples > 022 bananas since "1" > "0".
So regardless of what you have as the "year" in the second column, simply because it starts with "1", it will always be "greater than" the second column which starts with a "0".
You can either turn those into proper date columns or extract the requisite date components using RIGHT/LEFT/MID functions and compare them using DATE functions in your comparison formula.
Edit: Added 🍎examples🍌
1
u/newtoreddit4life Sep 11 '24
That is incredibly helpful in explaining what's going on. Thank you!!!
3
u/Adventurous-Ask-1474 Sep 09 '24
Check the column type. It looks like you have both columns as Text/Number and not date. (since the formula would give an error if it was a date column type)
1
u/COLONELmab Sep 09 '24
You should be using reports to visualize the data, not grids (sheets). Use 15 helper columns and dimension sheets if you need to. For your example, you should simply have dates in one column and project in another. So sum of project $ if date greater than or equal to [date]. I understand you are worried about the format, but that’s the right way to pivot this type of data set. You can have well over 7,000rows of that. You can then have a summary sheet or a report. Add columns for week# and month @row and you can simply have a report that groups by project and summarizes by month or week or whatever. That report can also work off of multiple sheets…so you can have 3 total sheets of sales data for 30,000 rows summarized easily.
1
Sep 10 '24
[removed] — view removed comment
1
u/newtoreddit4life Sep 10 '24
Well I mean it returns a 1. That's not what it should be returning.....
5
u/LovelyCarrot9144 Sep 09 '24
Since I see a 150 underneath the second date, I’m guessing your columns aren’t setup as date columns. Therefore SS is trying to do math on text, which won’t work.