Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Rohan
 
Posts: n/a
Default nested if(and) functions

Hi,

I need to create a function that can cope with more than 7 if ands, where it
can read what's in cell A1 and what's in cell B1 then spit out a defined
value in C1. For example,

If A1="a" and B1="a", then 1, but if A1="a" and B1="b", then 2 and so on for
combinations aa, ab, ac, ad, ae, ba, bb, bc..........ea, eb, ec, ed and ee.
My formula below works but only gets me up to bc.

=IF(AND(A1="a",B1="a"),"1",IF(AND(A1="a",B1="b")," 2",IF(AND(A1="a",B1="c"),"3",IF(AND(A1="a",B1="d") ,"3",IF(AND(A1="b",B1="a"),"2",IF(AND(A1="b",B1="b "),"2",IF(AND(A1="b",B1="c"),"3",)))))))

I've found some tricks to get around the 7-limit IF functions but can't seem
to make them work for my nest IF(AND) function.

I hope this makes sense. Any help would be most appreciated.

thanks.

Rohan.

  #2   Report Post  
JE McGimpsey
 
Posts: n/a
Default

I would do something like:

J K L M N
1 a b c d
2 a 1 2 3 3
3 b 2 2 3 4
4 c 3 3 4 4


The use something like:

=VLOOKUP(A1,J:N,MATCH(B1,J1:N1,FALSE),FALSE)




In article ,
"Rohan" wrote:

Hi,

I need to create a function that can cope with more than 7 if ands, where it
can read what's in cell A1 and what's in cell B1 then spit out a defined
value in C1. For example,

If A1="a" and B1="a", then 1, but if A1="a" and B1="b", then 2 and so on for
combinations aa, ab, ac, ad, ae, ba, bb, bc..........ea, eb, ec, ed and ee.
My formula below works but only gets me up to bc.

=IF(AND(A1="a",B1="a"),"1",IF(AND(A1="a",B1="b")," 2",IF(AND(A1="a",B1="c"),"3"
,IF(AND(A1="a",B1="d"),"3",IF(AND(A1="b",B1="a")," 2",IF(AND(A1="b",B1="b"),"2"
,IF(AND(A1="b",B1="c"),"3",)))))))

I've found some tricks to get around the 7-limit IF functions but can't seem
to make them work for my nest IF(AND) function.

I hope this makes sense. Any help would be most appreciated.

thanks.

Rohan.

  #3   Report Post  
Rohan
 
Posts: n/a
Default

beautiful. Thanks very much.

"JE McGimpsey" wrote:

I would do something like:

J K L M N
1 a b c d
2 a 1 2 3 3
3 b 2 2 3 4
4 c 3 3 4 4


The use something like:

=VLOOKUP(A1,J:N,MATCH(B1,J1:N1,FALSE),FALSE)




In article ,
"Rohan" wrote:

Hi,

I need to create a function that can cope with more than 7 if ands, where it
can read what's in cell A1 and what's in cell B1 then spit out a defined
value in C1. For example,

If A1="a" and B1="a", then 1, but if A1="a" and B1="b", then 2 and so on for
combinations aa, ab, ac, ad, ae, ba, bb, bc..........ea, eb, ec, ed and ee.
My formula below works but only gets me up to bc.

=IF(AND(A1="a",B1="a"),"1",IF(AND(A1="a",B1="b")," 2",IF(AND(A1="a",B1="c"),"3"
,IF(AND(A1="a",B1="d"),"3",IF(AND(A1="b",B1="a")," 2",IF(AND(A1="b",B1="b"),"2"
,IF(AND(A1="b",B1="c"),"3",)))))))

I've found some tricks to get around the 7-limit IF functions but can't seem
to make them work for my nest IF(AND) function.

I hope this makes sense. Any help would be most appreciated.

thanks.

Rohan.


  #4   Report Post  
Biff
 
Posts: n/a
Default

Hi!

Create a table that lists all the combinations and their corresponding
values:

AA 1
AB 2
AC 3
AD 3
BA 2
BB 2
BC 3

Assume this table is in the range F1:G7

Then use this formula in C1:

=IF(ISNA(VLOOKUP(A1&B1,F1:G7,2,0)),"",VLOOKUP(A1&B 1,F1:G7,2,0))

Biff

"Rohan" wrote in message
...
Hi,

I need to create a function that can cope with more than 7 if ands, where
it
can read what's in cell A1 and what's in cell B1 then spit out a defined
value in C1. For example,

If A1="a" and B1="a", then 1, but if A1="a" and B1="b", then 2 and so on
for
combinations aa, ab, ac, ad, ae, ba, bb, bc..........ea, eb, ec, ed and
ee.
My formula below works but only gets me up to bc.

=IF(AND(A1="a",B1="a"),"1",IF(AND(A1="a",B1="b")," 2",IF(AND(A1="a",B1="c"),"3",IF(AND(A1="a",B1="d") ,"3",IF(AND(A1="b",B1="a"),"2",IF(AND(A1="b",B1="b "),"2",IF(AND(A1="b",B1="c"),"3",)))))))

I've found some tricks to get around the 7-limit IF functions but can't
seem
to make them work for my nest IF(AND) function.

I hope this makes sense. Any help would be most appreciated.

thanks.

Rohan.



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
Why are my nested sub-totals are displaying incorrectly? chiefdean13 Excel Discussion (Misc queries) 1 July 20th 05 05:45 AM
Nested IF statements John Simons Excel Worksheet Functions 14 February 16th 05 06:17 AM
€śUse of more then 7 nested if statement€ť Faisal Yameen Excel Worksheet Functions 3 January 12th 05 06:02 PM
€śUse of more then 7 nested if statement€ť Faisal Yameen Excel Worksheet Functions 0 January 12th 05 05:17 PM
€śUse of more then 7 nested if statement€ť Faisal Yameen Excel Worksheet Functions 2 January 12th 05 04:20 PM


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