Query current month plus X days (1 Viewer)

mbryant1hr

New member
Local time
Today, 02:19
Joined
Sep 24, 2020
Messages
5
I need a formula to query the current month plus 45 days.
Thank you,
M
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:19
Joined
Oct 29, 2018
Messages
21,467
Hi. Welcome to AWF!

Check out the DateSerial() function.
 

mbryant1hr

New member
Local time
Today, 02:19
Joined
Sep 24, 2020
Messages
5
Hi. Thanks for the Welcome.
I found this formula on Stackoverflow but I can't get it to work either:
BETWEEN DateSerial(Year(Date()); Month(Date()); 1) AND DateSerial(Year(Date()); Month(Date()) + 2; 0)
It is not exactly what I am looking for but it could work, if I could get it to work. LOL...This can't be that hard.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:19
Joined
Oct 29, 2018
Messages
21,467
Hi. Thanks for the Welcome.
I found this formula on Stackoverflow but I can't get it to work either:
BETWEEN DateSerial(Year(Date()); Month(Date()); 1) AND DateSerial(Year(Date()); Month(Date()) + 2; 0)
It is not exactly what I am looking for but it could work, if I could get it to work. LOL...This can't be that hard.
Hi. Let's start slow... First, let's see if you can filter for only THIS month, okay?
Code:
BETWEEN DateSerial(Year(Date()),Month(Date()),1) And DateSerial(Year(Date()),Month(Date())+1,0)
Let us know if that works.
 

mbryant1hr

New member
Local time
Today, 02:19
Joined
Sep 24, 2020
Messages
5
Ah, I see......the commas.
Yes, it worked now and I changed the 1 to a 2 in the second part and it is pulling both current and next month's data.
Thank you so much!
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:19
Joined
Oct 29, 2018
Messages
21,467
Ah, I see......the commas.
Yes, it worked now and I changed the 1 to a 2 in the second part and it is pulling both current and next month's data.
Thank you so much!
Okay, glad to hear you got it sorted out. So, you don't need the plus 45 days part anymore?
 

mbryant1hr

New member
Local time
Today, 02:19
Joined
Sep 24, 2020
Messages
5
Okay, glad to hear you got it sorted out. So, you don't need the plus 45 days part anymore?
That would be nice but I don't any more time to try and figure it out today. :)
Thank you again for your help!
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:19
Joined
Oct 29, 2018
Messages
21,467
That would be nice but I don't any more time to try and figure it out today. :)
Thank you again for your help!
Well, let's see. I gave you formula to return THIS month's data (that's 30 days, or so).

You changed that formula to return THIS month's and NEXT month's data (that's 60 days, give or take).

In your original question, you said you wanted THIS month PLUS 45 DAYS, that would be around 75 (30+45) days. So, there's a difference of 15 days between what you originally wanted and what you have so far.
 

mbryant1hr

New member
Local time
Today, 02:19
Joined
Sep 24, 2020
Messages
5
Well, let's see. I gave you formula to return THIS month's data (that's 30 days, or so).

You changed that formula to return THIS month's and NEXT month's data (that's 60 days, give or take).

In your original question, you said you wanted THIS month PLUS 45 DAYS, that would be around 75 (30+45) days. So, there's a difference of 15 days between what you originally wanted and what you have so far.
Yes, but for real though, I can make this formula work for what I need to do with it. It saves me from having to export to excel and alter the data, which was an unnecessary step.
Thank you again,
M-
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:19
Joined
Oct 29, 2018
Messages
21,467
Yes, but for real though, I can make this formula work for what I need to do with it. It saves me from having to export to excel and alter the data, which was an unnecessary step.
Thank you again,
M-
Of course. You can modify the formula as you see fit. Good luck with your project.
 

Users who are viewing this thread

Top Bottom