ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Multiple Logical Conditions With Date and String Comparison Not wo (https://www.excelbanter.com/excel-worksheet-functions/164354-multiple-logical-conditions-date-string-comparison-not-wo.html)

Anurag

Multiple Logical Conditions With Date and String Comparison Not wo
 
For some reason =IF(OR(AS6="TODAY",YEAR(AS6)1900),TRUE,FALSE) is not working
together.
AS6 is just one of the cells and I would like the cell to be formatted if
the cell entry is either a date (obviously a recent one) or the word "Today".
However, if I seperate the two, they work just fine.
Any suggestions?

T. Valko

Multiple Logical Conditions With Date and String Comparison Not wo
 
The problem is that when the cell contains "Today" then the YEAR() function
returns a #VALUE! error and causes the formula to error. Since you're just
returning a Boolean you can don't need the IF. Try it like this:

=OR(AS6="TODAY",YEAR(N(AS6))1900)


--
Biff
Microsoft Excel MVP


"Anurag" wrote in message
...
For some reason =IF(OR(AS6="TODAY",YEAR(AS6)1900),TRUE,FALSE) is not
working
together.
AS6 is just one of the cells and I would like the cell to be formatted if
the cell entry is either a date (obviously a recent one) or the word
"Today".
However, if I seperate the two, they work just fine.
Any suggestions?




Anurag

Multiple Logical Conditions With Date and String Comparison No
 
That worked out like a charm. What's the N() for?

And being new to this community, would you mind answering one adminstrative
question: how can I rate your response?

"T. Valko" wrote:

The problem is that when the cell contains "Today" then the YEAR() function
returns a #VALUE! error and causes the formula to error. Since you're just
returning a Boolean you can don't need the IF. Try it like this:

=OR(AS6="TODAY",YEAR(N(AS6))1900)


--
Biff
Microsoft Excel MVP


"Anurag" wrote in message
...
For some reason =IF(OR(AS6="TODAY",YEAR(AS6)1900),TRUE,FALSE) is not
working
together.
AS6 is just one of the cells and I would like the cell to be formatted if
the cell entry is either a date (obviously a recent one) or the word
"Today".
However, if I seperate the two, they work just fine.
Any suggestions?





T. Valko

Multiple Logical Conditions With Date and String Comparison No
 
What's the N() for?

When the cell contains "Today" N prevents the YEAR function from returning
an error. If the argument to N is a number it returns that number. If the
argument to N is text it returns 0. The argument to the YEAR function must
be a number otherwise it returns an error. So, when the cell contains
"Today" N returns 0 as the argument to the YEAR function and the whole YEAR
test then evaluates to FALSE:

YEAR(N("Today"))1900 =

YEAR(N(0))1900 =

YEAR(0)1900 =

01900 = FALSE

how can I rate your response?


Well, I don't access these groups through the web interface as you have so I
don't know exactly how that works. I do occasionally look around on the web
interface and from what I can see there's a button at the bottom of the post
window that asks if the post was helpful. I think you have to be a
registered user and logged in to rate a post. Beyond that I don't really
know!

--
Biff
Microsoft Excel MVP


"Anurag" wrote in message
...
That worked out like a charm. What's the N() for?

And being new to this community, would you mind answering one
adminstrative
question: how can I rate your response?

"T. Valko" wrote:

The problem is that when the cell contains "Today" then the YEAR()
function
returns a #VALUE! error and causes the formula to error. Since you're
just
returning a Boolean you can don't need the IF. Try it like this:

=OR(AS6="TODAY",YEAR(N(AS6))1900)


--
Biff
Microsoft Excel MVP


"Anurag" wrote in message
...
For some reason =IF(OR(AS6="TODAY",YEAR(AS6)1900),TRUE,FALSE) is not
working
together.
AS6 is just one of the cells and I would like the cell to be formatted
if
the cell entry is either a date (obviously a recent one) or the word
"Today".
However, if I seperate the two, they work just fine.
Any suggestions?








All times are GMT +1. The time now is 01:25 AM.

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