user94628
user94628

Reputation: 3731

Set a date with Excel

I'm trying to take a date and create a date in the previous month with a different day selected. I've tried using EOMONTH to go back to previous month and then to set the day to the 15th:

EOMONTH(TEXT(G9,-1),"dd")="15"

This gives me a #NUM! error though. Is there any other way to set a date to the previous month?

Thanks

Upvotes: 0

Views: 63

Answers (2)

Scott C Wilson
Scott C Wilson

Reputation: 20036

EOMONTH is in the analysis toolpak - have you loaded that?

Also your syntax didn't include an = sign - did you use one? You want =EOMONTH, not just EOMONTH.

The correct syntax for the 15th of the prior month based off the cell G9 is

=EOMONTH(G9, -2)+15

Upvotes: 3

JosieP
JosieP

Reputation: 3410

you could use

=DATE(YEAR(G9),MONTH(G9)-1,15)

Upvotes: 3

Related Questions