+ Reply to Thread
Results 1 to 3 of 3

Thread: Need help with a nested if function

  1. #1
    Registered User
    Join Date
    12-20-2011
    Location
    Kansas
    MS-Off Ver
    Excel 2007
    Posts
    2

    Need help with a nested if function

    I have been struggling with a function using a nested IF statement. Here is what I am trying to do.

    I have a row of 16 values in my spreadsheet (C5:R5) that represents the results of a series of weekly scores. If the number of values (scores) in the row equals 10 (U5), then deduct the lowest value in the row from the sum of the weekly values. If the number of weekly values =11, then deduct the 2 lowest. If the number of weekly values >=12, then deduct the 3 lowest.

    This is the nested IF function I am trying to use, but it is returning an error:
    =IF(U5=10,S5-SMALL(C5:R5,1),IF(U5=11,S5-((SMALL(C5:R5,1)+(SMALL(C5:R5,2)),IF(U5>=12,-(((SMALL(C5:R5,1)+(SMALL(C5:R5,2)+(SMALL(C5:R5,3)))))))))))

    I can get the first two IF statements to run but when I add the third I get the error. Parenthesis error? Can anyone help?

    Thank you!

  2. #2
    Forum Moderator Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    5,953

    Re: Need help with a nested if function

    Hi Double Eagle, welcome to the forum.

    Looks like some parenthesis errors, and a missing S5. Perhaps try one of these:

    =IF(U5=10,S5-SMALL(C5:R5,1),IF(U5=11,S5-SMALL(C5:R5,1)-SMALL(C5:R5,2),IF(U5>=12,S5-SMALL(C5:R5,1)-SMALL(C5:R5,2)-SMALL(C5:R5,3),S5)))

    =IF(U5=10,S5-SMALL(C5:R5,1),IF(U5=11,S5-SUM(SMALL(C5:R5,{1,2})),IF(U5>=12,S5-SUM(SMALL(C5:R5,{1,2,3})),S5)))

  3. #3
    Registered User
    Join Date
    12-20-2011
    Location
    Kansas
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Need help with a nested if function

    Quote Originally Posted by Paul View Post
    Hi Double Eagle, welcome to the forum.

    Looks like some parenthesis errors, and a missing S5. Perhaps try one of these:

    =IF(U5=10,S5-SMALL(C5:R5,1),IF(U5=11,S5-SMALL(C5:R5,1)-SMALL(C5:R5,2),IF(U5>=12,S5-SMALL(C5:R5,1)-SMALL(C5:R5,2)-SMALL(C5:R5,3),S5)))

    =IF(U5=10,S5-SMALL(C5:R5,1),IF(U5=11,S5-SUM(SMALL(C5:R5,{1,2})),IF(U5>=12,S5-SUM(SMALL(C5:R5,{1,2,3})),S5)))

    Thank you very much! I didn't realize you had replied to my question until today. I must have not set up my notifications correctly.

    Again, many thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0