Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 160
Default Nested IF not working.....

Here is the formula that I'm using:

=IF(K2={71876,147825,186110,73859,1183639,163773,1 40408,226473},"GSA",IF(K2={235842,245561,235823,23 5843,245337,239135,200830},"CNB",IF(K2={683983,245 144,29839,4813,67555,175821,82901,175645,139429,17 5397,131445,979352,113854,972262,174756,218880,335 8},"CB","ADJ")))

When K2 has any of the values listed in the first part of the IF it returns
GSA, like it's supposed to. BUT....if any of the other values listed in the
subsequent parts are in K2 it always list ADJ, like it's not in any of the
other list. I can't get it to return CNB or CB. Any ideas why?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,069
Default Nested IF not working.....

If I enter 235842 in K2, your formula returns CNB, and if I enter 683983, it
returns CB. I don't know for sure, but I might guess that Excel doesn't like
more than one array of values in brackets in a single formula. It seems to
accept the first value in each subsequent array and ignore the rest. Instead
of the nested IFs, you could enter the numbers and the values they should
return in a couple of empty columns, then use a VLOOKUP formula. If, for
example, you entered your data like this in columns M & N:

71876 GSA
147825 GSA
186110 GSA
73859 GSA
1183639 GSA
16773 GSA
140408 GSA
226473 GSA
235842 CNB
245561 CNB
235823 CNB
etc.

Your Vlookup formula would be

=IF(ISERROR(VLOOKUP(K2,M:N,2,FALSE)),"ADJ",VLOOKUP (K2,M:N,2,FALSE))

If it finds the K2 number in column M, the code next to it in column N is
returned. If the K2 value is not found in column M, ADJ is returned.

Hope this helps,

Hutch

"Patrick" wrote:

Here is the formula that I'm using:

=IF(K2={71876,147825,186110,73859,1183639,163773,1 40408,226473},"GSA",IF(K2={235842,245561,235823,23 5843,245337,239135,200830},"CNB",IF(K2={683983,245 144,29839,4813,67555,175821,82901,175645,139429,17 5397,131445,979352,113854,972262,174756,218880,335 8},"CB","ADJ")))

When K2 has any of the values listed in the first part of the IF it returns
GSA, like it's supposed to. BUT....if any of the other values listed in the
subsequent parts are in K2 it always list ADJ, like it's not in any of the
other list. I can't get it to return CNB or CB. Any ideas why?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Nested IF not working.....

When K2 has any value in the first part of the formula other than 71876, it
returns "ADJ" for me.

you'll need to use OR for your conditional tests.
OR(K2={71876,147825,186110,73859,1183639,163773,14 0408,226473})

"Patrick" wrote:

Here is the formula that I'm using:

=IF(K2={71876,147825,186110,73859,1183639,163773,1 40408,226473},"GSA",IF(K2={235842,245561,235823,23 5843,245337,239135,200830},"CNB",IF(K2={683983,245 144,29839,4813,67555,175821,82901,175645,139429,17 5397,131445,979352,113854,972262,174756,218880,335 8},"CB","ADJ")))

When K2 has any of the values listed in the first part of the IF it returns
GSA, like it's supposed to. BUT....if any of the other values listed in the
subsequent parts are in K2 it always list ADJ, like it's not in any of the
other list. I can't get it to return CNB or CB. Any ideas why?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,345
Default Nested IF not working.....

You need to enclose your arrays in an OR() function:

=IF(OR(K2={71876,147825,186110,73859,1183639,16377 3,140408,226473}),"GSA",IF(OR(K2={235842,245561,23 5823,235843,245337,239135,200830}),"CNB",IF(OR(K2= {683983,245144,29839,4813,67555,175821,82901,17564 5,139429,175397,131445,979352,113854,972262,174756 ,218880,3358}),"CB","ADJ")))

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Patrick" wrote in message
...
Here is the formula that I'm using:

=IF(K2={71876,147825,186110,73859,1183639,163773,1 40408,226473},"GSA",IF(K2={235842,245561,235823,23 5843,245337,239135,200830},"CNB",IF(K2={683983,245 144,29839,4813,67555,175821,82901,175645,139429,17 5397,131445,979352,113854,972262,174756,218880,335 8},"CB","ADJ")))

When K2 has any of the values listed in the first part of the IF it
returns
GSA, like it's supposed to. BUT....if any of the other values listed in
the
subsequent parts are in K2 it always list ADJ, like it's not in any of the
other list. I can't get it to return CNB or CB. Any ideas why?



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

That worked perfect. Thanks so much. I knew I was close.

"JMB" wrote:

When K2 has any value in the first part of the formula other than 71876, it
returns "ADJ" for me.

you'll need to use OR for your conditional tests.
OR(K2={71876,147825,186110,73859,1183639,163773,14 0408,226473})

"Patrick" wrote:

Here is the formula that I'm using:

=IF(K2={71876,147825,186110,73859,1183639,163773,1 40408,226473},"GSA",IF(K2={235842,245561,235823,23 5843,245337,239135,200830},"CNB",IF(K2={683983,245 144,29839,4813,67555,175821,82901,175645,139429,17 5397,131445,979352,113854,972262,174756,218880,335 8},"CB","ADJ")))

When K2 has any of the values listed in the first part of the IF it returns
GSA, like it's supposed to. BUT....if any of the other values listed in the
subsequent parts are in K2 it always list ADJ, like it's not in any of the
other list. I can't get it to return CNB or CB. Any ideas why?



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Nested IF not working.....

you're welcome.

"Patrick" wrote:

That worked perfect. Thanks so much. I knew I was close.

"JMB" wrote:

When K2 has any value in the first part of the formula other than 71876, it
returns "ADJ" for me.

you'll need to use OR for your conditional tests.
OR(K2={71876,147825,186110,73859,1183639,163773,14 0408,226473})

"Patrick" wrote:

Here is the formula that I'm using:

=IF(K2={71876,147825,186110,73859,1183639,163773,1 40408,226473},"GSA",IF(K2={235842,245561,235823,23 5843,245337,239135,200830},"CNB",IF(K2={683983,245 144,29839,4813,67555,175821,82901,175645,139429,17 5397,131445,979352,113854,972262,174756,218880,335 8},"CB","ADJ")))

When K2 has any of the values listed in the first part of the IF it returns
GSA, like it's supposed to. BUT....if any of the other values listed in the
subsequent parts are in K2 it always list ADJ, like it's not in any of the
other list. I can't get it to return CNB or CB. Any ideas why?

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 Function not working Paula Excel Worksheet Functions 11 July 4th 08 03:31 AM
Outlining in nested subtotals not working Debi C Excel Worksheet Functions 1 October 28th 06 07:57 PM
Countif with nested function not working? jshuatree Excel Worksheet Functions 4 July 17th 06 10:48 PM
COMPARING DATES with nested IF not working- Syntax is correct though Richard Flame Excel Discussion (Misc queries) 2 July 12th 06 07:04 PM
Nested IF(AND is not working Todd F. Excel Worksheet Functions 13 June 24th 05 10:20 PM


All times are GMT +1. The time now is 11:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"