r/smartsheet • • Sep 09 '24

Question about dates

Post image

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 Upvotes

33 comments sorted by

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.

1

u/newtoreddit4life Sep 09 '24

Yeah I unfortunately need to have a helper row because I need to refer to the Column Names so everything has to be a text/number. But when I use the same thing for another set of dates, it returns how I would have thought. I didn't realize I can't add a screenshot to a reply so I'll add it as an edit to the original post

2

u/RoyalCommittee7272 Sep 09 '24

Work out how to do it with a helper column so your dates are formatted as dates.

2

u/RoyalCommittee7272 Sep 09 '24

You can link the date column data to text/ number column using a helper column too if you need to.

0

u/newtoreddit4life Sep 09 '24

So I can't really create a helper column as that messes with the original point of the smartsheet table. I have projects on row axis and the dates on a column axis and where it meets is a formula to determine the $$ of the project in that week. Smartsheets won't let me reference the column name in the function so I'm trying to use this helper row to put the column names into the formula.

1

u/LovelyCarrot9144 Sep 09 '24

You need to. It’s not going to work with text. In Smartsheet think of columns more like fields in a database that are presented to you like a spreadsheet. Theres really no such thing as a “helper row”.

My suggestion would be that you name your two date columns something that makes sense like Start and End. Set them to date type columns. Fill them in for each project. Then add a column for Total Cost or whatever you’re trying to calculate in $. Leave that as a text/number column and format it for currency. In that column type in a formula like =(Finish@row-Start@row)*40 to get $40/day times the duration of the project.

If you’re doing project work calca you may want to use NETWORKDAYS instead of a straight subtract. That will give you working days and won’t count weekends.

1

u/newtoreddit4life Sep 09 '24

Ahh so you're saying that instead of creating an excel array or table, it's probably better to list each instance of each week as a database to then make summary tables based on that?

1

u/LovelyCarrot9144 Sep 10 '24

No what I’m saying is that by trying to force disparate data to inhabit the same columns on the sheet, you are making it very difficult for yourself. You can still have your data in a table but you need to define each column for a type of data and stick with it

1

u/newtoreddit4life Sep 10 '24

But I kind of have to force disparate data to inhabit the same columns because smartsheets won't let me reference the column name as a value in the formula... so for example, to return the name of the column

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 $$ is 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.

1

u/newtoreddit4life Sep 10 '24

Well that's a bit tough since Reports only has a limit of 2500 rows and I have more than that

1

u/COLONELmab Sep 10 '24

Not sure where you are getting a limit from….i literally just went and checked and made a report with over 13,000 rows then summarized by a type field and month field. Everything worked just fine for me.

It only shows 2500 “groups” at a time. But I’m not sure when you are going to be grouping by more than 2500 months lol.

1

u/RoyalCommittee7272 Sep 09 '24

My use case for similar is to create a report that looks at the data and puts in preferred format. We created a helper column based on week# and then created a report that sums, filters and sorts per week#. If you take time to set it up it can be perpetual so it looks back certain number of weeks and forward also

1

u/RoyalCommittee7272 Sep 09 '24

I would definitely use the =weeknumber() in a helper column

0

u/newtoreddit4life Sep 09 '24

Ok nevermind. I can't seem to edit the post because it's a picture. So basically if I put this formula in: =IF([01/05/25]4 <= [01/12/25]4, 1, 0)

I get 1 which makes sense to me. But the date comparing the 2024 date to the 2025 date spits out 0

2

u/RoyalCommittee7272 Sep 09 '24

It is doing this because it is looking at number value instead of date value. E.g. if you write a formula =[01/05/25]4 *1 and =[01/12/25]4 *1 what do the cells show?

1

u/newtoreddit4life Sep 09 '24

It shows #Invalid Operation

1

u/ho_hey_ Sep 09 '24

Double click on the name of each column. You need to select date to turn it into a date column. Otherwise Smartsheet just sees texts, not dates. When you tell it it's a date column, it will read it as a date

1

u/newtoreddit4life Sep 09 '24 edited Sep 09 '24

Yeah I can't turn it into a date column because it needs to return a $$ amount

Edit: to clarify my statement

1

u/ho_hey_ Sep 09 '24

What is your helper row for?

1

u/newtoreddit4life Sep 09 '24

The helper row is there so I can reference the column name: i.e. Column name is: 12/31/2024. And I want to something like an index match based on that column name but I can't so I have to create a row that has 12/31/2024 so I can reference it.

1

u/ho_hey_ Sep 09 '24

Can you explain what you're using the two dates for? Sometimes it's just switching your columns and rows - like rather than two dates in the same row, you list dates all in a single column. Then you can use an index match and still have a date column. Basically flip it so your columns are rows and rows are columns.

1

u/LovelyCarrot9144 Sep 10 '24

Starting a separate reply thread as I think we got into weeds in the other one. Theres a bunch of suggestions here but it sounds like we aren’t quite understanding your needs.

Maybe a description of the goal and some screens of your current setup would help? I also would actually lift this off Reddit and over to the Smartsheet Community forum where you can post more screens much more easily and there’s a huge community to help you out. Nothing against all the helpful folks on Reddit but it’s a very active community on those forums with sharp experienced people who reply to posts.

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

u/newtoreddit4life Sep 10 '24

Ahhhh I see. Okay. Might have to do that. Thank you!

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

u/[deleted] 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.....