+ Reply to Thread
Results 1 to 5 of 5

Nested IF statement to recognize root 'codes'

  1. #1
    Registered User
    Join Date
    07-05-2009
    Location
    Brisbane
    MS-Off Ver
    Excel 2007
    Posts
    61

    Nested IF statement to recognize root 'codes'

    Yesterday i had an issue recognizing codes which was solved by using the =sumif() function.

    Basically if the code is 110 add together all amounts attached to that code and sum them in a new cell. Perfect.

    Now however there is an added level of complexity and i need to figure out how to nest an IF statement into a =sumif() function so that code amounts are summed into their root code, for example the root code of 110, 120, 130 is 100.

    So basically i want a function that will sum the specific code (110) and then sum together that amount under the root code (100).

    Here is an example.

    The amounts for the lower level codes have been summed but i need the high level codes to be summed together.

    Thank you for your time
    Attached Files Attached Files
    Last edited by Ace of Clubs; 07-06-2009 at 09:37 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Nested IF statement to recognize root 'codes'

    In C3:

    =SUMPRODUCT(--(FLOOR(Actuals!$H$2:$H$200,100) = $B3), Actuals!$F$2:$F$200)
    Last edited by JBeaucaire; 07-06-2009 at 09:04 PM. Reason: Added absolute references so formula can be copied easily
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    07-05-2009
    Location
    Brisbane
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: Nested IF statement to recognize root 'codes'

    Quote Originally Posted by JBeaucaire View Post
    In C3:

    =SUMPRODUCT(--(FLOOR(Actuals!$H$2:$H$200,100) = $B3), Actuals!$F$2:$F$200)
    Thanks again.

    Just another question.

    How would i modify it go up another level of complexity, say for a 3 level code (eg. 1000, 1100, 1110).

    Edit: And if it isn't too much trouble could you please explain that function. I'm having a bit of trouble understanding how it works.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Nested IF statement to recognize root 'codes'

    Go simple and lookup the Excel help files on FLOOR() (Press F1). FLOOR is a kind of rounding, so it pushes all the values down to the level of significance you request. In the formula I gave you, we FLOOR all values down to the next 100.

    You can choose any significance you want...100, 1000, 33...whatever.

  5. #5
    Registered User
    Join Date
    07-05-2009
    Location
    Brisbane
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: Nested IF statement to recognize root 'codes'

    Quote Originally Posted by JBeaucaire View Post
    Go simple and lookup the Excel help files on FLOOR() (Press F1). FLOOR is a kind of rounding, so it pushes all the values down to the level of significance you request. In the formula I gave you, we FLOOR all values down to the next 100.

    You can choose any significance you want...100, 1000, 33...whatever.
    Ahhh i understand.

    Thanks so much

+ 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.6.0 RC 1