Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default 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?



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default 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?




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default 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?






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
Comparison of alphanumeric string ErExcel Excel Discussion (Misc queries) 4 May 7th 07 02:14 PM
Logical conditions... could somebody help me jimmy Excel Discussion (Misc queries) 3 January 26th 07 09:56 PM
comparison string VBA excell stats Excel Discussion (Misc queries) 5 March 16th 06 10:12 PM
How do I set up multiple logical conditions on one result cell Ring eye Excel Worksheet Functions 1 January 12th 06 07:31 PM
Logical Test comparison using cell color chamuko Excel Discussion (Misc queries) 2 November 9th 05 03:09 AM


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

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"