Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default How do I write an If(And( function using dates as my logical test?

I'm trying to write a formula which would help me identify all dates within a
month and give me a result that says "July" or "Aug" or whatever.
This is the formula that I tried but didn't work:
=IF(AND(6/30/2009A1,7/30/2009<=A1),"July")

A B
1 6/30/2009 July
2 7/4/2009 July
3 7/15/2009 July

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,722
Default How do I write an If(And( function using dates as my logical test?

XL thinks you are inputing division, not dates. Change to:
=IF(AND(DATEVALUE("6/30/2009")A1,DATEVALUE("7/30/2009")<=A1),"July")

Note that the simpler formula would be to just use
=MONTH(A1)
and custom format the cell as mmmm

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"mclovin" wrote:

I'm trying to write a formula which would help me identify all dates within a
month and give me a result that says "July" or "Aug" or whatever.
This is the formula that I tried but didn't work:
=IF(AND(6/30/2009A1,7/30/2009<=A1),"July")

A B
1 6/30/2009 July
2 7/4/2009 July
3 7/15/2009 July

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default How do I write an If(And( function using dates as my logical test?

Maybe just using:

=text(a1,"mmmm")
would be enough to see the month.

(I'm assuming that you really meant to include July 31st in July, too.)

mclovin wrote:

I'm trying to write a formula which would help me identify all dates within a
month and give me a result that says "July" or "Aug" or whatever.
This is the formula that I tried but didn't work:
=IF(AND(6/30/2009A1,7/30/2009<=A1),"July")

A B
1 6/30/2009 July
2 7/4/2009 July
3 7/15/2009 July


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default How do I write an If(And( function using dates as my logical test?

=IF(AND(6/30/2009A1,7/30/2009<=A1),"July")

Can't tell from your formula why you're using those boundaries. If you want
the month name based on any date:

=TEXT(A1,"mmmm")


--
Biff
Microsoft Excel MVP


"mclovin" wrote in message
...
I'm trying to write a formula which would help me identify all dates
within a
month and give me a result that says "July" or "Aug" or whatever.
This is the formula that I tried but didn't work:
=IF(AND(6/30/2009A1,7/30/2009<=A1),"July")

A B
1 6/30/2009 July
2 7/4/2009 July
3 7/15/2009 July



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default How do I write an If(And( function using dates as my logical test?

=MONTH(A1)
will always return a number between 1 and 12.

When you format that cell as "mmmm", you'll always see January.

=A1
formatted to:
mmmm

would work fine.



Luke M wrote:

XL thinks you are inputing division, not dates. Change to:
=IF(AND(DATEVALUE("6/30/2009")A1,DATEVALUE("7/30/2009")<=A1),"July")

Note that the simpler formula would be to just use
=MONTH(A1)
and custom format the cell as mmmm

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*

"mclovin" wrote:

I'm trying to write a formula which would help me identify all dates within a
month and give me a result that says "July" or "Aug" or whatever.
This is the formula that I tried but didn't work:
=IF(AND(6/30/2009A1,7/30/2009<=A1),"July")

A B
1 6/30/2009 July
2 7/4/2009 July
3 7/15/2009 July


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I use 'CONTAINS' in an IF Logical Test? MichaelRobert Excel Worksheet Functions 3 April 2nd 23 08:11 PM
A logical test in the If function for blank, i.e., If blank? egii Excel Worksheet Functions 5 September 16th 09 11:46 AM
EXCEL 2000 - IF function returns wrong result from logical test Sean Duffy Excel Worksheet Functions 8 October 15th 08 09:58 PM
Can I create an "IF" function using cell color as a logical test? JessLynn Excel Worksheet Functions 1 June 25th 08 08:09 PM
Logical Test Melody Excel Worksheet Functions 5 February 20th 08 03:26 AM


All times are GMT +1. The time now is 12:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"