Looking for formula confirmation

stapuff

Well-known Member
Joined
Feb 19, 2004
Messages
1,126
I wrote the following and it appears to be giving me the correct result, but.................

My criteria = I want to see all the results from (Current Month - 2) to Today. (5/1/2007 - Today)

Between DateSerial(Year(Now()),Month(Now())-2,1) And DateSerial(Year(Now()),Month(Now())+1,0)

Looking for someone to confirm or suggest.

Thanks,

Kurt
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Kurt

You'd probably be better of using DateDiff and Today.

I don't quite understand how the second DateSerial would return today's date, if that's what it's supposed to do.
 
Upvote 0
Norie -
You are correct. I posted
"My criteria = I want to see all the results from (Current Month - 2) to Today. (5/1/2007 - Today)"

When I should have posted
"My criteria = I want to see all the results for the previous 2 months through Today. (5/1/2007 - Today)"
 
Upvote 0
Many ways to skin a cat...

How about the Dateadd/DateSerial in conjuction?

Between
Dateadd("m", -2, DateSerial(Year(Now),Month(Now),1))
and
Now()

I added your expression to a query and it worked just fine the way it was. Mine also worked, but it's not like I put either through a lot of testing to see if there were any loopholes!

Max
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,588
Members
449,039
Latest member
Arbind kumar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top