Why does this formula not work today?
=DATE(YEAR(TODAY()), MONTH(TODAY()), DAY(TODAY()) - WEEKDAY(TODAY()))
It is the Weekday part of the formula that is stopping it from running. Using INT and VALUE and whatever else I can think of doesn't work.
Answers
-
Never mind. GDI
-
Hi @L@123
Did you figure it out? Was it the parenthesis?
=DATE(YEAR(TODAY()), MONTH(TODAY()), DAY(TODAY())) - WEEKDAY(TODAY())
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
I think it was this portion...
DAY(TODAY()) - WEEKDAY(TODAY())
3 - 4 = -1
-1 can't be used as a day within a DATE function.
@L@123 Is that what it was?
-
Yeah paul got it... this was part of a long running very complex sheet that gathers and outputs current month KPI's. I guess people just weren't checking it in the beginning of the month and/or guessing there just wasn't data in the charts yet. About panicked when I saw it had failed. Ended up simplifying the formula to the below:
=TODAY() - WEEKDAY(TODAY()) + 1
Actually the entire formula is:
=TODAY() - WEEKDAY(TODAY()) + 1 + "-" + (TODAY() - WEEKDAY(TODAY()) - 1 + 8)
to output the current week, I just simplified it for this question.
-
@L@123 Wouldn't "+ 7" work the same as "-1 + 8"? I just know you like to simplify when you can, so...
-
Lol yeah, I spotted that after I posted it and questioned if I should fix it or not. The reason it is like that is to have a pattern between all the values I've posted, it makes it easier to troubleshoot. But you are correct it could be made more efficient with
=TODAY() - WEEKDAY(TODAY()) + 1 + "-" + (TODAY() - WEEKDAY(TODAY()) +7
-
Haha. I noticed you had used +7 in your other thread where you are tracking your more commonly used formulas (which is a great idea).
Having said that... Sometimes it is actually better to go with -1+8 though if it maintains a pattern for troubleshooting. I have a few formulas of my own that are more "complicated" than they really need to be simply because I wanted to keep a specific pattern throughout the sheet for easier troubleshooting.
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 139 Industry Talk
- 472 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 496 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!