+ Reply to Thread
Results 1 to 4 of 4

Joining nested IF functions

  1. #1
    Registered User
    Join Date
    02-18-2013
    Location
    Ireland
    MS-Off Ver
    Excel 2007
    Posts
    7

    Joining nested IF functions

    Dear All

    I am aiming to classify Column E as 'Type' 1-7 on the basis of values in columns D and C. If values in D are <80 then I need to base the type (column E) on values in column C. So for example, if column D is <80 and column C is>=10, <50 then the type value in column E should be '2'. I have produced a formula for this which works OK:

    =IF(D2<80,IF(C2<10,"1",IF(AND(C2>=10,C2<50),"2",IF(AND(C2>=50,C2<100),"3",IF(AND(C2>=100,C2<200),"5",IF(C2>=200,"7"))))))

    I also need another formula for when column D is >80. A similar situation applied but with slightly different types in column E based on values in column C. I have produced this formula which works OK:

    =IF(D2>80,IF(C2<10,"1",IF(AND(C2>=10,C2<50),"2",IF(AND(C2>=50,C2<100),"4",IF(AND(C2>=100,C2<200),"6",IF(C2>=200,"7"))))))


    The problem is, these formulas work fine in separate columns but I cannot seem to join them into one large formula. I have tried to join them but I keep getting 'FALSE' when D values are >80. Basically it wont recognize the second half of the formula (D>80...) when joined. Ideally I would have one column for Type rather than 2 which I currently have.

    If anyone can help here I would be most grateful.

    AT0

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,080

    Re: Joining nested IF functions

    You can shorten that first formula to

    =IF(D2<80,LOOKUP(C2,{-1E99,10,50,100,200},{1,2,3,5,7}),"")

    and the second one to

    =IF(D2>80,LOOKUP(C2,{-1E99,10,50,100,200},{1,2,4,6,7}),"")

    With that in mind try this merged formula

    =IF(D2<80,LOOKUP(C2,{-1E99,10,50,100,200},{1,2,3,5,7}),LOOKUP(C2,{-1E99,10,50,100,200},{1,2,4,6,7}))
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    02-18-2013
    Location
    Ireland
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Joining nested IF functions

    Thank you very much Special-K, you've nailed it! That works well and is a much more practical way of doing things than my previous attempt.

    I appreciate your help

    AT0

  4. #4
    Registered User
    Join Date
    02-18-2013
    Location
    Ireland
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Joining nested IF functions

    OK, I now have a follow-on question which I've been trying to solve based upon Special-K's recent answer. Now that Special-K has given me a formula to identify 'Type' I now need to make additional categories based upon these types.

    So, If column D is type 1,2,4 or 6 I need to test values in column F against a set of criteria to display a category in column G. For example, If column D is type 1, 2, 4 or 6 and F is<=3 then G should be "H". If F is<=4 the column G should be "G". If F is <=6 then column G should be "M" and so on to category "P". I have adapted Special-K's formula to this which seems to work:

    =IF(OR(D2=1,D2=2,D2=4,D2=6),LOOKUP(F2,{-1E+99,3,4,6,7.5},{"H","G","M","P"}))

    The next step is to repeat this for types (column D) 3, 5 and 7, which have a different set of criteria. For example If column D is type 3, 5 or 7 and F is <=4 then column G should be "H". I have used this which seems OK:

    =IF(OR(D2=3,D2=5,D2=7),LOOKUP(F2,{-1E+99,4,5,6.5,9},{"H","G","M","P"}))

    My problem is once again joining the formulae together. I have tried the approach suggested by Special-k which worked for the previous problem, but it doesn't seem to work here. i.e. I've tried:

    =IF(OR(D2=1,D2=2,D2=4,D2=6),LOOKUP(F2,{-1E+99,3,4,6,7.5},{"H","G","M","P"}),LOOKUP(F2,{-1E+99,4,5,6.5,9},{"H","G","M","P"}))

    But this doesn't seem to work.
    I have been researching the Lookup function and I can't seem to grasp what is wrong here. Again, it doesn't account for D being 3,5 or 7 this time.

    If anyone can put me right here and explain what is going wrong I'd be very grateful.

    Yours,

    AT0

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Joining/Linking nested formulas
    By Aikisteve in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-07-2006, 12:10 PM
  2. [SOLVED] NESTED IF FUNCTIONS
    By EuGene C. White in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-04-2006, 08:10 PM
  3. [SOLVED] Nested Functions with OR
    By bill ch in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-07-2006, 01:35 PM
  4. [SOLVED] Nested functions HELP!
    By db in forum Excel Formulas & Functions
    Replies: 24
    Last Post: 09-06-2005, 09:05 PM
  5. [SOLVED] Nested functions HELP!
    By chiefnmd in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 04:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1