Multiple Logical Conditions With Date and String Comparison Not wo

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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)
 
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?
 
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 =

0>1900 = 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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top