#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 21
Default Nested IF

I have a simple quesion about nested IF formula. I need to look up 3 values
each in a range, and if all matches show "Y" for yes otherwise "N" for no. My
formula below showed "Y" when the all 3 conditions are met, but I when I
changed one of the condition to a value that doesn't exist in the range, the
result was still "Y" instead of "N". Can someone tell me why i'm getting a
wrong answer, or whether my formula is not correct? Thanks.

=IF(((AND(Z13,AC9:AC28,AA13,AF9:AF28,AB13,AG9:AG28 ))),"Y","N")



--
when u change the way u look @ things, the things u look at change.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,722
Default Nested IF

What is the relationship of Z13 to AC9:AC28? From your contex,t ti sounds
like your wanting to look something up, but you don't say that in the
formula. I think you want:

=IF(AND(ISNUMBER(MATCH(Z13,AC9:AC28,0)),ISNUMBER(M ATCH(AA13,AF9:AF28,0)),ISNUMBER(MATCH(AB13,AG9:AG2 8,0))),"Y","N")

Note that now the formula states to find each value. If found, a number is
generated. Thus, if I get 3 numbers back, condition is met.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"EZ" wrote:

I have a simple quesion about nested IF formula. I need to look up 3 values
each in a range, and if all matches show "Y" for yes otherwise "N" for no. My
formula below showed "Y" when the all 3 conditions are met, but I when I
changed one of the condition to a value that doesn't exist in the range, the
result was still "Y" instead of "N". Can someone tell me why i'm getting a
wrong answer, or whether my formula is not correct? Thanks.

=IF(((AND(Z13,AC9:AC28,AA13,AF9:AF28,AB13,AG9:AG28 ))),"Y","N")



--
when u change the way u look @ things, the things u look at change.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 320
Default Nested IF

WHAT 3 conditions are you talking about? Your formula has 6 RANGES, no
conditions. The AND function expects a range consisting of TRUEs or FALSEs,
not simply values. The IF statement's first parameter expects a TRUE or
FALSE condition, but you didn't put in any condition. If you wanted to see
if the value in Z13 existed in the range AC9:AC28, you need to use MATCH:
=MATCH(Z13,AC9:AC28,0) which will return a number, so to convert that to a
TRUE/FALSE you need =ISNUMBER(MATCH(Z13,AC9:AC28,0)), so perhaps what you
want is:
=IF(AND(ISNUMBER(MATCH(Z13,AC9:AC28,0)),ISNUMBER(M ATCH(AA13,AF9:AF28,0)),ISNUMBER(MATCH(AB13,AG9:AG2 8,0))),"Y","N")

Bob Umlas
Excel MVP

"EZ" wrote in message
...
I have a simple quesion about nested IF formula. I need to look up 3 values
each in a range, and if all matches show "Y" for yes otherwise "N" for no.
My
formula below showed "Y" when the all 3 conditions are met, but I when I
changed one of the condition to a value that doesn't exist in the range,
the
result was still "Y" instead of "N". Can someone tell me why i'm getting a
wrong answer, or whether my formula is not correct? Thanks.

=IF(((AND(Z13,AC9:AC28,AA13,AF9:AF28,AB13,AG9:AG28 ))),"Y","N")



--
when u change the way u look @ things, the things u look at change.



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Nested IF

Hi,
Your not getting the answer you expect vecause your formula is incorrect and
I'm not exactly sure what your tring to do but here's a guess. You want to
test if everying in af9 - af28 = z13 etc. If so try this

=IF(AND(COUNTIF(AC9:AC28,Z13)=20,COUNTIF(AF9:AF28, AA13)=20,COUNTIF(AG9:AG28,AB13)=20),"Y","N")

Mike

"EZ" wrote:

I have a simple quesion about nested IF formula. I need to look up 3 values
each in a range, and if all matches show "Y" for yes otherwise "N" for no. My
formula below showed "Y" when the all 3 conditions are met, but I when I
changed one of the condition to a value that doesn't exist in the range, the
result was still "Y" instead of "N". Can someone tell me why i'm getting a
wrong answer, or whether my formula is not correct? Thanks.

=IF(((AND(Z13,AC9:AC28,AA13,AF9:AF28,AB13,AG9:AG28 ))),"Y","N")



--
when u change the way u look @ things, the things u look at change.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 21
Default Nested IF

Thanks Luke, but it didn't work. It shows "N" all the time even though the
value does exist in my range. Each value/condition is of the same data type
as its pertaining range. my data is numbers entered as text because of
leading zeros, so I replaced ISNUMBER with ISTEXT, but still didn't work. The
relationship is like: Lookup the state name on the state names col, then
lookup the county name in the county names col, and finally lookup the city
name in the city names col, and if all 3 matches spit out "Y", otherwise "N".
My data actually different from this example, but to make it simple.

Thanks.
--
when u change the way u look @ things, the things u look at change.


"Luke M" wrote:

What is the relationship of Z13 to AC9:AC28? From your contex,t ti sounds
like your wanting to look something up, but you don't say that in the
formula. I think you want:

=IF(AND(ISNUMBER(MATCH(Z13,AC9:AC28,0)),ISNUMBER(M ATCH(AA13,AF9:AF28,0)),ISNUMBER(MATCH(AB13,AG9:AG2 8,0))),"Y","N")

Note that now the formula states to find each value. If found, a number is
generated. Thus, if I get 3 numbers back, condition is met.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"EZ" wrote:

I have a simple quesion about nested IF formula. I need to look up 3 values
each in a range, and if all matches show "Y" for yes otherwise "N" for no. My
formula below showed "Y" when the all 3 conditions are met, but I when I
changed one of the condition to a value that doesn't exist in the range, the
result was still "Y" instead of "N". Can someone tell me why i'm getting a
wrong answer, or whether my formula is not correct? Thanks.

=IF(((AND(Z13,AC9:AC28,AA13,AF9:AF28,AB13,AG9:AG28 ))),"Y","N")



--
when u change the way u look @ things, the things u look at change.



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 21
Default Nested IF

Thanks Luke and Bob. It worked. The issue was with my data ranges type. the
data was coming from Access as 'general' data type with leading zeros. My
lookup values/conditions in Excel have to be forced as text in order to keep
the leading zeros, so I went ahead and changed the ranges data type from
general to text, and it worked.

Thanks.
--
when u change the way u look @ things, the things u look at change.


"Luke M" wrote:

What is the relationship of Z13 to AC9:AC28? From your contex,t ti sounds
like your wanting to look something up, but you don't say that in the
formula. I think you want:

=IF(AND(ISNUMBER(MATCH(Z13,AC9:AC28,0)),ISNUMBER(M ATCH(AA13,AF9:AF28,0)),ISNUMBER(MATCH(AB13,AG9:AG2 8,0))),"Y","N")

Note that now the formula states to find each value. If found, a number is
generated. Thus, if I get 3 numbers back, condition is met.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"EZ" wrote:

I have a simple quesion about nested IF formula. I need to look up 3 values
each in a range, and if all matches show "Y" for yes otherwise "N" for no. My
formula below showed "Y" when the all 3 conditions are met, but I when I
changed one of the condition to a value that doesn't exist in the range, the
result was still "Y" instead of "N". Can someone tell me why i'm getting a
wrong answer, or whether my formula is not correct? Thanks.

=IF(((AND(Z13,AC9:AC28,AA13,AF9:AF28,AB13,AG9:AG28 ))),"Y","N")



--
when u change the way u look @ things, the things u look at change.

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
nested If Dave Shultz Excel Discussion (Misc queries) 3 March 3rd 09 05:52 PM
nested if based on nested if in seperate sheet. how? scouserabbit Excel Worksheet Functions 5 March 2nd 07 04:03 PM
Nested if mwavra Excel Worksheet Functions 4 February 6th 07 06:57 PM
nested if Ash Excel Worksheet Functions 1 May 31st 06 09:29 AM
Nested if bjd via OfficeKB.com Excel Worksheet Functions 4 June 21st 05 03:25 PM


All times are GMT +1. The time now is 11:51 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"