Countifs off by one

I am trying to get a count for a date range, but am getting a number that is one less compared to the filter.
Current Tuesday Formula: =IFERROR(TODAY() + (3 - WEEKDAY(TODAY())) - IF(OR(WEEKDAY(TODAY()) = 1, WEEKDAY(TODAY()) = 2), 7, 0), "")
Previous Tuesday Formula: =IFERROR(TODAY() - 7 + (3 - WEEKDAY(TODAY() - 7)) - IF(OR(WEEKDAY(TODAY() - 7) = 1, WEEKDAY(TODAY() - 7) = 2), 7, 0), "")
Total Count Formula: =COUNTIFS([Date Entered by Vendor]:[Date Entered by Vendor], AND(@cell >= [Previous Tuesday]#, @cell <= [Current Tuesday]#))
Here is the row that is not being caught in the formula.
Best Answer
-
Hi @Nick0000
The time zone issue sometimes causes the discrepancy.
For example, I set my Time Zone setting to GMT+9.
So, if I apply the DATEONLY function to the system column, Created, I get the previous date if the time is before 9:00 AM.
The Created displays the date in my time zone (GMT+9), but when we use a function like the DATEONLY, the calculation is based on UTC or GMT zone, so 8:30 AM in my time zone is still yesterday in London. So, the DATEONLY result is one day before.
Time zones and system columns
System columns always use UTC in the back-end, while the display value matches the time zone of the last person to access the sheet. This means that, although the display value is in the sheet-viewers time zone, formulas and API calls using system column data may return based on the UTC time zone.So, when you use the system date column to determine the date, you need to consider the time zone issue.
An easy way to get the Date part is to use the TEXT functions, as the system date columns display the date according to your time zone.
You can use a formula like this to get a local date.
=DATE(2000 + VALUE(MID([Date Entered by Vendor with Time]@row, 7, 2)), VALUE(LEFT([Date Entered by Vendor with Time]@row, 2)), VALUE(MID([Date Entered by Vendor with Time]@row, 4, 2)))
By the way, you can simplify the Current and Previous Tuesday formulas as these;
Current Tuesday Formula:
=TODAY() + 3 - WEEKDAY(TODAY())
Previous Tuesday Formula:
=[Current Tuesday]# - 7
Filter Display
Answers
-
Hi @Nick0000
The time zone issue sometimes causes the discrepancy.
For example, I set my Time Zone setting to GMT+9.
So, if I apply the DATEONLY function to the system column, Created, I get the previous date if the time is before 9:00 AM.
The Created displays the date in my time zone (GMT+9), but when we use a function like the DATEONLY, the calculation is based on UTC or GMT zone, so 8:30 AM in my time zone is still yesterday in London. So, the DATEONLY result is one day before.
Time zones and system columns
System columns always use UTC in the back-end, while the display value matches the time zone of the last person to access the sheet. This means that, although the display value is in the sheet-viewers time zone, formulas and API calls using system column data may return based on the UTC time zone.So, when you use the system date column to determine the date, you need to consider the time zone issue.
An easy way to get the Date part is to use the TEXT functions, as the system date columns display the date according to your time zone.
You can use a formula like this to get a local date.
=DATE(2000 + VALUE(MID([Date Entered by Vendor with Time]@row, 7, 2)), VALUE(LEFT([Date Entered by Vendor with Time]@row, 2)), VALUE(MID([Date Entered by Vendor with Time]@row, 4, 2)))
By the way, you can simplify the Current and Previous Tuesday formulas as these;
Current Tuesday Formula:
=TODAY() + 3 - WEEKDAY(TODAY())
Previous Tuesday Formula:
=[Current Tuesday]# - 7
Filter Display
-
Thank you!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 67.2K Get Help
- 451 Global Discussions
- 155 Industry Talk
- 505 Announcements
- 5.4K Ideas & Feature Requests
- 85 Brandfolder
- 156 Just for fun
- 80 Community Job Board
- 514 Show & Tell
- 34 Member Spotlight
- 2 SmartStories
- 308 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!