+ Reply to Thread
Results 1 to 17 of 17

sumif with multiple criterias

  1. #1
    Forum Contributor
    Join Date
    09-19-2017
    Location
    Taguig City, Philippines
    MS-Off Ver
    Microsoft Excel 2016
    Posts
    120

    sumif with multiple criterias

    Hi,

    Hope someone could help me out with my attached spreadsheet. Basically I just need to autopopulate the amounts in column H.

    As you can see I have the details in columns A-D, And in order to get the value in column H, I need to

    1. Lookup the account that I need using the acct code.
    2. Return in column H the value of that code. The value is the amount in column D less the amount in column C.
    3. You may notice that Car Expenses in column H is a combination of accounts 200.00-600.00, so I would also need the formula to be able to identify the codes in between.

    Hope this makes sense and hope someone could help me out.

    Thank you!
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: sumif with multiple criterias

    Probably the easiest way to do this (unless you want to include - (minus sign) in the depbit column, would be something like this...
    =SUMIF($B$5:$B$12,H5,$D$5:$D$12)-SUMIF($B$5:$B$12,H5,$C$5:$C$12)

    However, you will need to standardize your "names" so that excel knows that eg, "Fuel" and "Toll" etc are Car expenses. Same with Tax (although we could work around that)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: sumif with multiple criterias

    I just noticed that you have posted the same thread here, under a different ID.
    https://www.excelforum.com/excel-gen...ml#post4931718

    Please do not create multiple IDS. I have closed the other thread, please continue here. Also, please explain why you need 2 IDs, and why I should not delete the other 1?

  4. #4
    Forum Contributor
    Join Date
    09-19-2017
    Location
    Taguig City, Philippines
    MS-Off Ver
    Microsoft Excel 2016
    Posts
    120

    Re: sumif with multiple criterias

    Quote Originally Posted by FDibbins View Post
    Probably the easiest way to do this (unless you want to include - (minus sign) in the depbit column, would be something like this...
    =SUMIF($B$5:$B$12,H5,$D$5:$D$12)-SUMIF($B$5:$B$12,H5,$C$5:$C$12)

    However, you will need to standardize your "names" so that excel knows that eg, "Fuel" and "Toll" etc are Car expenses. Same with Tax (although we could work around that)
    Hi Ford,

    Unfortunately I couldn't standardize the names in column A as it is how they are being reported. but for consolidation purposes, I need the value under one line item in column H. Which is why I''m thinking of using the acct codes instead of the acct name.

  5. #5
    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,778

    Re: sumif with multiple criterias

    Please answer Ford's question about having two accounts on this forum:

    Please do not create multiple IDS. I have closed the other thread, please continue here. Also, please explain why you need 2 IDs, and why I should not delete the other 1?
    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.

  6. #6
    Forum Contributor
    Join Date
    09-19-2017
    Location
    Taguig City, Philippines
    MS-Off Ver
    Microsoft Excel 2016
    Posts
    120

    Re: sumif with multiple criterias

    Quote Originally Posted by AliGW View Post
    Please answer Ford's question about having two accounts on this forum:
    Hi Ali, I have explained myself privately. apologies for creating two IDs. Please do so delete the other one. Thank you.

  7. #7
    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,778

    Re: sumif with multiple criterias

    Thank you. Ford will delete the other ID - he is an administrator.

    I will have a look at your file now.

  8. #8
    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,778

    Re: sumif with multiple criterias

    The account codes are text, which is a problem. Can we convert them to real numbers?

  9. #9
    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,778

    Re: sumif with multiple criterias

    Here's a possible solution with a helper column, which could be hidden:

    Excel 2016 (Windows) 32 bit
    A
    B
    C
    D
    E
    4
    ACCT Code
    ACCT Name
    Debit
    Credit
    Helper
    5
    100.00
    Revenue
    $ 100,000.00
    100
    6
    200.00
    Fuel
    $ 60.00
    200
    7
    300.00
    Replacement
    $ 500.00
    300
    8
    400.00
    Maintenance
    $ 1,000.00
    400
    9
    500.00
    Parking
    $ 30.00
    500
    10
    600.00
    Toll
    $ 200.00
    600
    11
    700.00
    Furniture
    $ 120.00
    700
    12
    800.00
    Tax Payable
    $ 500.00
    $ 700.00
    800
    Sheet: Sheet1

    Excel 2016 (Windows) 32 bit
    E
    5
    =VALUE(A5)
    Sheet: Sheet1

    Excel 2016 (Windows) 32 bit
    G
    H
    I
    4
    AMOUNT
    5
    100
    Revenue
    $ 100,000.00
    6
    200-600
    Car Expenses
    $ (1,790.00)
    7
    700
    Furniture
    $ (120.00)
    8
    800
    Tax
    $ 200.00
    Sheet: Sheet1

    Excel 2016 (Windows) 32 bit
    I
    5
    =SUMIFS($D$5:$D$12,$E$5:$E$12,">="&LEFT(G5,3),$E$5:$E$12,"<="&RIGHT(G5,3))-SUMIFS($C$5:$C$12,$E$5:$E$12,">="&LEFT(G5,3),$E$5:$E$12,"<="&RIGHT(G5,3))
    Sheet: Sheet1

  10. #10
    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,778

    Re: sumif with multiple criterias

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  11. #11
    Forum Contributor
    Join Date
    09-19-2017
    Location
    Taguig City, Philippines
    MS-Off Ver
    Microsoft Excel 2016
    Posts
    120

    Re: sumif with multiple criterias

    Hi Ali,

    Thank you for your help. The reason why the numbers were set to text is because some codes from my main file have decimal codes like 900.01 or 900.13. With that being the case can I still use this formula by changing the 3 to 6? and retain the text format? Or does this only works on number format?

    =SUMIFS($D$5:$D$12,$E$5:$E$12,">="&LEFT(G5,3),$E$5:$E$12,"<="&RIGHT(G5,3))-SUMIFS($C$5:$C$12,$E$5:$E$12,">="&LEFT(G5,3),$E$5:$E$12,"<="&RIGHT(G5,3))

  12. #12
    Registered User
    Join Date
    09-12-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2013
    Posts
    38

    Re: sumif with multiple criterias

    I'd go a different route, make a lookup table that links the accounts to the header you want to group them by, ie introduce a hierarchy. Most accounting systems have something like this for reporting purposes.
    If you put your groupings on a separate sheet then use a vlookup or similar to return the grouping header then use sumif to get your summary reports.

    Sample attached
    I've highlighted in yellow where I have made changes.

    If you need to have a longer account/header list I'd put it on another sheet and refer the vlookups to an entire column rather than specific range.

    Ron
    Attached Files Attached Files

  13. #13
    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,778

    Re: sumif with multiple criterias

    Quote Originally Posted by MyStix01 View Post
    ... With that being the case can I still use this formula by changing the 3 to 6? and retain the text format? Or does this only works on number format?
    Try it and see! I think that Rondeondon's solution is probably the way to go, however. Let us know if you still need help with this.

  14. #14
    Forum Contributor
    Join Date
    09-19-2017
    Location
    Taguig City, Philippines
    MS-Off Ver
    Microsoft Excel 2016
    Posts
    120

    Re: sumif with multiple criterias

    Hi, thank you for your responses. One question though, how do I change the result from having a negative value?. Thank you.

  15. #15
    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,778

    Re: sumif with multiple criterias

    What do you mean?

    Maybe this:

    =ABS(SUMIFS($D$5:$D$12,$E$5:$E$12,">="&LEFT(G5,3),$E$5:$E$12,"<="&RIGHT(G5,3))-SUMIFS($C$5:$C$12,$E$5:$E$12,">="&LEFT(G5,3),$E$5:$E$12,"<="&RIGHT(G5,3)))

  16. #16
    Forum Contributor
    Join Date
    09-19-2017
    Location
    Taguig City, Philippines
    MS-Off Ver
    Microsoft Excel 2016
    Posts
    120

    Re: sumif with multiple criterias

    Hi, thank you for your responses. I tried both your formulas, I included a separate sheet as masterlist. This should work now in my spreadsheet. Thank you sooooooooooooo much...

  17. #17
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: sumif with multiple criterias

    Happy to help

+ 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: 6
    Last Post: 02-23-2018, 07:09 PM
  2. IF's and SUMIF's Formula to forecast based on multiple Criterias
    By Bolwahnn in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-24-2014, 01:01 AM
  3. sumif with multiple criterias including countif"s
    By Armitage2k in forum Excel General
    Replies: 7
    Last Post: 07-29-2011, 08:24 AM
  4. Sumif with about 1,000 criterias
    By FortuneSyn in forum Excel General
    Replies: 12
    Last Post: 03-17-2010, 03:05 PM
  5. multiple criterias in SUMIF formula
    By aysrun in forum Excel General
    Replies: 8
    Last Post: 07-29-2009, 02:40 AM
  6. sumif with multiple criterias
    By ben803 in forum Excel General
    Replies: 5
    Last Post: 03-25-2009, 09:04 PM
  7. [SOLVED] SUMIF with 2 criterias
    By Laddy in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-25-2005, 09:06 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