+ Reply to Thread
Results 1 to 6 of 6

Nesting an IF() function inside an already complex multiple IF() function

  1. #1
    Registered User
    Join Date
    10-10-2016
    Location
    Coimbra, Portugal
    MS-Off Ver
    2016
    Posts
    86

    Nesting an IF() function inside an already complex multiple IF() function

    Hi.
    I have this scenario:

    Wrong.jpg

    E3: =IF($K3="—", F3-1, IF(HLOOKUP($K3, $B$2:$F$2, 1, 0) = E$2, $G3, IF(HLOOKUP($K3, $B$2:$F$2, 1, 0) > E$2, F3-1, "—")))
    D3: =IF($K3="—", E3-1, IF(HLOOKUP($K3, $B$2:$F$2, 1, 0) = D$2, $G3, IF(HLOOKUP($K3, $B$2:$F$2, 1, 0) > D$2, E3-1, "—")))
    C2: =IF($K3="—", D3-1, IF(HLOOKUP($K3, $B$2:$F$2, 1, 0) = C$2, $G3, IF(HLOOKUP($K3, $B$2:$F$2, 1, 0) > C$2, D3-1, "—")))
    B3: =IF($K3="—", C3-1, IF(HLOOKUP($K3, $B$2:$F$2, 1, 0) = B$2, $G3, IF(HLOOKUP($K3, $B$2:$F$2, 1, 0) > B$2, C3-1, "—")))

    I need to nest another IF() function inside these so that all cells to the left of the cell with "1" show "0" instead of negative numbers, like this:

    Right.jpg

    I can' figure out the logic on these IF() functions - they are way over my head.
    Please, help.

    PR

    P.S.: Big thanks to @FDibbins for helping out in the construction of the IF()s functions - I just forgot about the negative numbers.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Nesting an IF() function inside an already complex multiple IF() function

    Rather than another IF() condition, how about a MAX() function? I'm thinking something like =MAX(0,current IF() function)
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    10-10-2016
    Location
    Coimbra, Portugal
    MS-Off Ver
    2016
    Posts
    86

    Re: Nesting an IF() function inside an already complex multiple IF() function

    It did work, but the "—" turned into $VALUE!.

    screenshot.jpg

    I added the =MAX(0, current IF() function) to B13, C13, D13, E13 andF13.
    Here's the new file.

    PR
    Attached Files Attached Files

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Nesting an IF() function inside an already complex multiple IF() function

    If this formula:

    IF($K13="—", $G13, IF($K13=98, $G13, "—"))

    results in anything that is not a number (e.g. "--"), then the MAX function will return a #VALUE! error.

    Try this:

    =IFERROR(MAX(0, IF($K13="—", $G13, IF($K13=98, $G13, "—"))),"—")
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Registered User
    Join Date
    10-10-2016
    Location
    Coimbra, Portugal
    MS-Off Ver
    2016
    Posts
    86

    Re: Nesting an IF() function inside an already complex multiple IF() function

    Perfect Ali, thank you.
    Thank you both.

    PR

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Nesting an IF() function inside an already complex multiple IF() function

    You're welcome!

+ 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. Replies: 2
    Last Post: 07-03-2018, 02:26 PM
  2. Nesting IF & Lookup function to retrieve multiple values
    By agroeneveld in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-13-2017, 01:22 PM
  3. Nesting and Index and Match function inside an IF function
    By breckleeb in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-29-2016, 11:06 AM
  4. Calling function inside function. (aka nested function)
    By jakopak in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2015, 05:58 AM
  5. Help nesting an OR function inside a SUMIFS function
    By wes228 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-21-2014, 06:22 PM
  6. [SOLVED] Problems with multiple matches inside an index-function
    By Sidehosw in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-14-2014, 07:53 AM
  7. [SOLVED] Nesting Networkdays function inside and If function
    By Addison in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-13-2006, 03:10 PM

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