ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help Needed w/ IF statement using dates (https://www.excelbanter.com/excel-programming/336467-help-needed-w-if-statement-using-dates.html)

japorms[_4_]

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


mangesh_yadav[_371_]

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


Norman Jones

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




KL

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



paul

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




Bob Phillips[_6_]

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.



Richard Buttrey

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
__________________________

Mangesh Yadav[_4_]

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
__________________________





All times are GMT +1. The time now is 05:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com