Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help Needed w/ IF statement using dates


I have a problem with if statement using date data.

today() = 8/5/2005

I put a formula =if(today()=8/5/2005,true,false)

it's displaying a false answer when it should be displaying true

Hope somebody help me with this. thanks!


--
japorms
------------------------------------------------------------------------
japorms's Profile: http://www.excelforum.com/member.php...fo&userid=6544
View this thread: http://www.excelforum.com/showthread...hreadid=393200

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Help Needed w/ IF statement using dates

Hi JA,

I thimk that, in the formula, Excel treats 8/5/2005 as a double division of
integer values.

If you try entering 8/5/2005 in another cell and use that cell reference in
the formula in place of the date string, you should get the result you
expect. This is because Excel then recognises the cell entry as a date.

alternatively, the following worked for me:

=IF(TODAY()=DATE(2005,8,5),TRUE,FALSE)

or

=IF(TODAY()=DATEVALUE("8/5/05"),TRUE,FALSE)


---
Regards,
Norman



"japorms" wrote in
message ...

I have a problem with if statement using date data.

today() = 8/5/2005

I put a formula =if(today()=8/5/2005,true,false)

it's displaying a false answer when it should be displaying true

Hope somebody help me with this. thanks!


--
japorms
------------------------------------------------------------------------
japorms's Profile:
http://www.excelforum.com/member.php...fo&userid=6544
View this thread: http://www.excelforum.com/showthread...hreadid=393200



  #3   Report Post  
Posted to microsoft.public.excel.programming
KL KL is offline
external usenet poster
 
Posts: 201
Default Help Needed w/ IF statement using dates

Hi japorms,

I put a formula =if(today()=8/5/2005,true,false)


What your formula does in reality is to compare today's date with reresult
of two operations: 8 divided by 5 divided by 2005 :-)
Apart from that the use of the IF function in your fomula is wasteful as an
equation already retutns TRUE or FALSE by default.

You could use the following formulas:

=TODAY()=--"8/5/2005"
=TODAY()=DATE(2005,8,5)
=TODAY()=VALUE("8/5/2005")
=TODAY()=DATEVALUE("8/5/2005")
=TEXT(TODAY(),"m/d/yyyy")="8/5/2005"

Regards,
KL


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default Help Needed w/ IF statement using dates

even easier and more flexible?
A1 type = today(),A2 type 5/8/2005(or whatever),A3 type A1=A2,result = true
or false.
--
paul
remove nospam for email addy!



"KL" wrote:

Hi japorms,

I put a formula =if(today()=8/5/2005,true,false)


What your formula does in reality is to compare today's date with reresult
of two operations: 8 divided by 5 divided by 2005 :-)
Apart from that the use of the IF function in your fomula is wasteful as an
equation already retutns TRUE or FALSE by default.

You could use the following formulas:

=TODAY()=--"8/5/2005"
=TODAY()=DATE(2005,8,5)
=TODAY()=VALUE("8/5/2005")
=TODAY()=DATEVALUE("8/5/2005")
=TEXT(TODAY(),"m/d/yyyy")="8/5/2005"

Regards,
KL



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Help Needed w/ IF statement using dates


"KL" wrote in message
...

=TODAY()=--"8/5/2005"


Better to use ISO standard --"2005-08-05", no confusion then as to whether
it is 5th Aug or 8th May.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help Needed w/ IF statement using dates


Use:

=IF(TODAY()=DATEVALUE("8/5/2005"),TRUE,FALSE)

Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=393200

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 296
Default Help Needed w/ IF statement using dates

On Fri, 5 Aug 2005 01:25:34 -0500, mangesh_yadav
wrote:


Use:

=IF(TODAY()=DATEVALUE("8/5/2005"),TRUE,FALSE)

Mangesh



Unless of course you're working with UK (& European?) style dates,
where the 5th August is generally shown as 5/8/2005.

Anyone know a general solution which would presumably use the system
locale somewhere in the formula, or is this only possible using VBA
code?

Rgds
__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Help Needed w/ IF statement using dates

Hi Richard,

The general (and always safest) is to use:
=Date(2005,8,5)
(thats 5th Aug 2005)

Mangesh




"Richard Buttrey" wrote in
message ...
On Fri, 5 Aug 2005 01:25:34 -0500, mangesh_yadav
wrote:


Use:

=IF(TODAY()=DATEVALUE("8/5/2005"),TRUE,FALSE)

Mangesh



Unless of course you're working with UK (& European?) style dates,
where the 5th August is generally shown as 5/8/2005.

Anyone know a general solution which would presumably use the system
locale somewhere in the formula, or is this only possible using VBA
code?

Rgds
__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________



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
IF AND Statement Needed Daren Excel Worksheet Functions 2 March 26th 09 08:30 PM
Help needed would this be an IF statement pano Excel Worksheet Functions 5 February 11th 07 06:37 PM
If statement ... help needed. parsonsamie Excel Worksheet Functions 3 December 14th 06 12:43 AM
Another IF statement needed Connie Martin Excel Worksheet Functions 4 November 16th 06 08:56 PM
IF STATEMENT HELP NEEDED!!! Excel Dummy Excel Discussion (Misc queries) 2 December 30th 05 07:02 PM


All times are GMT +1. The time now is 12:04 PM.

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

About Us

"It's about Microsoft Excel"