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

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
this seems to work well unless you're in January, and the Year(Now()) function will mess you up if you're looking for a prior year month.
 
Upvote 0
You say you want the "To" date to be 5/1/07 because that is Today. But your expression gives the last day of the current month. Do you want it to be Today, or the last day of the current month? For Today, all you need would be Date() rather than going through the DateSerial function.

When I looked at your expression, I agreed with LxQ. But then I tested it, and found that in January of 2007, by subtracting 2 from the 1 for January, I ended up in Nov 1, 2006. So DateSerial will take the -1 for a month in 2007 and give you the correct month and year. VERY NICE job from Microsoft. Would not have believed it if I had not seen it.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,748
Members
448,989
Latest member
mariah3

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