A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

If Statement - Returning Quarter based on Specific Date



 
 
Thread Tools Display Modes
  #1  
Old March 29th, 2010, 03:26 PM posted to microsoft.public.excel.newusers
Jamie
external usenet poster
 
Posts: 317
Default If Statement - Returning Quarter based on Specific Date

Am using the following formula to determine which quarter a payment was made.
The first statement returns true, however, the second returns false and the
date is 1/21/10.
=IF(AND(G1512/31/09,G154/1/10),"1Q","Continue")
Thanks!
Ads
  #2  
Old March 29th, 2010, 04:59 PM posted to microsoft.public.excel.newusers
T. Valko
external usenet poster
 
Posts: 15,759
Default If Statement - Returning Quarter based on Specific Date

=IF(AND(G1512/31/09,G154/1/10),"1Q","Continue")

Your dates aren't being evaluated as dates. They're being evaluated as the
math operation:

12 divided by 31 divided by 9 = 0.043010752688172
4 divided by 1 divided by 10 = 0.4

So, if G15 = the date 1/21/2010 then:

AND(G1512/31/09,G154/1/10)

Will *never* be TRUE.

Use cells to hold the dates:

A1 = 12/31/2009
B1 = 4/1/2010

=IF(AND(G15A1,G15B1),"1Q","Continue")

--
Biff
Microsoft Excel MVP


"Jamie" wrote in message
...
Am using the following formula to determine which quarter a payment was
made.
The first statement returns true, however, the second returns false and
the
date is 1/21/10.
=IF(AND(G1512/31/09,G154/1/10),"1Q","Continue")
Thanks!



  #3  
Old March 29th, 2010, 05:59 PM posted to microsoft.public.excel.newusers
Joe User[_2_]
external usenet poster
 
Posts: 757
Default If Statement - Returning Quarter based on Specific Date

"Jamie" wrote:
Am using the following formula to determine
which quarter a payment was made. The first
statement returns true, however, the second
returns false and the date is 1/21/10.
=IF(AND(G1512/31/09,G154/1/10),"1Q","Continue")


In that form, 12/31/09 is interpreted as 12 divided by 31 divided by 9, not
a date.

You can write:

=IF(AND(G15--"12/31/09",G15--"4/1/10"),
"1Q","Continue")

But that is consider poor form. It is better to write:

=IF(AND(G15date(2009,12,31),G15date(2010,4,1)),
"1Q","Continue")
  #4  
Old March 30th, 2010, 01:36 PM posted to microsoft.public.excel.newusers
Jamie
external usenet poster
 
Posts: 317
Default If Statement - Returning Quarter based on Specific Date

This works perfectly now and explained the reason for some of the results.
Thanks!!

"T. Valko" wrote:

=IF(AND(G1512/31/09,G154/1/10),"1Q","Continue")


Your dates aren't being evaluated as dates. They're being evaluated as the
math operation:

12 divided by 31 divided by 9 = 0.043010752688172
4 divided by 1 divided by 10 = 0.4

So, if G15 = the date 1/21/2010 then:

AND(G1512/31/09,G154/1/10)

Will *never* be TRUE.

Use cells to hold the dates:

A1 = 12/31/2009
B1 = 4/1/2010

=IF(AND(G15A1,G15B1),"1Q","Continue")

--
Biff
Microsoft Excel MVP


"Jamie" wrote in message
...
Am using the following formula to determine which quarter a payment was
made.
The first statement returns true, however, the second returns false and
the
date is 1/21/10.
=IF(AND(G1512/31/09,G154/1/10),"1Q","Continue")
Thanks!



.

  #5  
Old March 30th, 2010, 04:38 PM posted to microsoft.public.excel.newusers
T. Valko
external usenet poster
 
Posts: 15,759
Default If Statement - Returning Quarter based on Specific Date

You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"Jamie" wrote in message
...
This works perfectly now and explained the reason for some of the results.
Thanks!!

"T. Valko" wrote:

=IF(AND(G1512/31/09,G154/1/10),"1Q","Continue")


Your dates aren't being evaluated as dates. They're being evaluated as
the
math operation:

12 divided by 31 divided by 9 = 0.043010752688172
4 divided by 1 divided by 10 = 0.4

So, if G15 = the date 1/21/2010 then:

AND(G1512/31/09,G154/1/10)

Will *never* be TRUE.

Use cells to hold the dates:

A1 = 12/31/2009
B1 = 4/1/2010

=IF(AND(G15A1,G15B1),"1Q","Continue")

--
Biff
Microsoft Excel MVP


"Jamie" wrote in message
...
Am using the following formula to determine which quarter a payment was
made.
The first statement returns true, however, the second returns false and
the
date is 1/21/10.
=IF(AND(G1512/31/09,G154/1/10),"1Q","Continue")
Thanks!



.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:01 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright 2004-2020 OfficeFrustration.
The comments are property of their posters.