Finding month in mm/dd/yyyy format

A

Andrew

Hello,
Given a column of dates in the mm/dd/yyyy format, how would I write a
function which would return only the month for each cell. I need the
month to be written out as numbers 1 through 12, or as Jan, Feb, etc.
Using the J, F, M, A, M month notation won't work because there are
too many duplicates.

Example: column 1 has dates, column 2 has daily temperatures, column 3
will contain all the temperatures for the month of January, column 4
for Feb, etc. So column three should have some function as follows:

=IF(column1 month = January, column2, "")

If someone knows how to do this, I'd appreciate it.

thanks
 
J

Jim Thomlinson

There is a month funciton which takes a date as an argument and returns the
numbers 1 though 12 corresponding to the month...
 
R

Rick Rothstein

Assuming A1 contains the date. If you want the month number...

=MONTH(A1)

If you want the abbreviated month name...

=TEXT(A1,"mmm")

If you want the full month name...

=TEXT(A1,"mmmm")
 
J

JoeU2004

Andrew said:
Given a column of dates in the mm/dd/yyyy format,
how would I write a function which would return
only the month for each cell. I need the month
to be written out as numbers 1 through 12

If A1 contains the date (in any format), MONTH(A1) returns the month number
between 1 and 12.

Example: column 1 has dates, column 2 has daily temperatures,
column 3 will contain all the temperatures for the month of
January, column 4 for Feb, etc.

If A1 contains the date and B1 contains the temperature, then put the
following formula into C1 and copy across through N1:

=IF(MONTH($A1)=COLUMN(C1)-COLUMN($B1),$B1,"")

Then copy the row down as needed. Be careful with the "$"; I purposely
wrote $A1, not $A$1, and I purposely wrote C1, not $C1.


----- original message -----
 
J

JLGWhiz

You could put this in column C and copy down as far as needed.

IF(TEXT(A1, "mmmm") = "January", B1, "")
 
A

Andy

Assuming A1 contains the date. If you want the month number...

=MONTH(A1)

If you want the abbreviated month name...

=TEXT(A1,"mmm")

If you want the full month name...

=TEXT(A1,"mmmm")

thanks for the help. The month() function worked perfectly.
 

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