Format(xxx,"mmm") producing wrong result

  • Thread starter Pascoe via AccessMonster.com
  • Start date
P

Pascoe via AccessMonster.com

Hi there,

I am trying to display the month in three letters ("mmm") format for 6 months
ago.

I am using this statement:

=Format(Month(DateSerial(Year(Date()),Month(Date())-6,1)),"mmm")

And the answer is being produced as "Jan", and blatantly February - 6 <>
"Jan"!

My Computer date is 11 February 2010, so there's no confusion about my
internal PC date! What am I doing wrong?

Any comments?

Thank you!
Russell.
 
M

Mike Painter

Pascoe said:
Hi there,

I am trying to display the month in three letters ("mmm") format for
6 months ago.

I am using this statement:

=Format(Month(DateSerial(Year(Date()),Month(Date())-6,1)),"mmm")

And the answer is being produced as "Jan", and blatantly February - 6
<> "Jan"!

My Computer date is 11 February 2010, so there's no confusion about my
internal PC date! What am I doing wrong?
What are you trying to do?
I suspect it is because your parenthesis are wrong.

As far as I know DateSerial requires three values
You have DateSerial(Year(Date())
Let that be X and you have
Month(X ,Month(Date()), etc.
 
P

Pascoe via AccessMonster.com

Shoul;d have read the forum more thoroughly first!

This seems to work:

=MonthName(Month(DateSerial(Year(Date()),Month(Date())-6,1)),True)

Cheers!
 
J

John W. Vinson

Shoul;d have read the forum more thoroughly first!

This seems to work:

=MonthName(Month(DateSerial(Year(Date()),Month(Date())-6,1)),True)

Or Format(DateSerial(Year(Date()), Month(Date()) - 1, 1), "MMM")
 
P

Pascoe via AccessMonster.com

Yes! Wood for the trees!

Thanks both of you for your thoughts.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top