+ Reply to Thread
Results 1 to 12 of 12

SUM all raw data by code IF main cell contains its code

  1. #1
    Registered User
    Join Date
    09-23-2021
    Location
    Bosnia and Herzegovina ����
    MS-Off Ver
    365
    Posts
    5

    Question SUM all raw data by code IF main cell contains its code

    Hello guys!

    I have an issue - which is not classic partial SUMIFS problem - at least I do not I think it is.

    I have a detailed raw-data expenditure sheet, with each transaction recorded per budget code.
    I need to sum all expenditures in the budget template - but the catch is that some of the budget lines have multiple budget codes assigned.

    The tables look something like this:

    RAW data:
    RAW_DATA.png

    BUDGET:
    BUDGET.png


    Any thought on this?

    Thank you very much <3
    Attached Images Attached Images

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider (Windows 11 64-bit)
    Posts
    52,108

    Re: SUM all raw data by code IF main cell contains its code

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook.

    Where in the world is B&H???
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!

    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.
    Don't forget to say "thank you" to those who have helped you in your thread. If you wish, you can also reward them by clicking on their reputation star bottom left.

  3. #3
    Registered User
    Join Date
    09-23-2021
    Location
    Bosnia and Herzegovina ����
    MS-Off Ver
    365
    Posts
    5

    Re: SUM all raw data by code IF main cell contains its code

    Bosnia and Herzegovina - Europe



    Sorry - still getting used to the forum. I am not sure if I attached it correctly?
    Attached Files Attached Files

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider (Windows 11 64-bit)
    Posts
    52,108

    Re: SUM all raw data by code IF main cell contains its code

    Thanks - I'll have a look.

    Please update your profile to something that everyone will understand regarding your location (Bosnia and Hezegovina OR Europe will do). B&H is not going to mean anything to most people. Thanks.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider (Windows 11 64-bit)
    Posts
    52,108

    Re: SUM all raw data by code IF main cell contains its code

    OK - you have multiple items in cells in column A - can these be avoided? They are going to complicate the issue.

  6. #6
    Registered User
    Join Date
    09-23-2021
    Location
    Bosnia and Herzegovina ����
    MS-Off Ver
    365
    Posts
    5

    Re: SUM all raw data by code IF main cell contains its code

    Thank you very much for your efforts.

    Unfortunately no - that is the core of my problem. I have not budgeted this. Usually I do everything in my power to avoid assigning multiple codes to budget line.

  7. #7
    Valued Forum Contributor
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    381

    Re: SUM all raw data by code IF main cell contains its code

    caution : you have to separate both budgetcodes only with character 10 (=ALT+Enter), no ";"-character !!!!
    perhaps it's better to do it in 2 cells
    Attached Files Attached Files
    Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

  8. #8
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    2007, Office 365
    Posts
    12,220

    Re: SUM all raw data by code IF main cell contains its code

    Edit: There was a mistake in my last formula. I neglected to remove the ";" characters.

    If your set can tolerate a helper column this will work.

    Helper column formula in 'Budget' column E counts the number of Budget codes in each cell of column B
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    In D2 and filled down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by FlameRetired; 09-23-2021 at 03:45 PM.
    Dave

  9. #9
    Valued Forum Contributor
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,135

    Re: SUM all raw data by code IF main cell contains its code

    BUDGET

    D2=SUMPRODUCT((ISNUMBER(SEARCH('RAW DATA'!$A$2:$A$16,BUDGET!B2)))*('RAW DATA'!$B$2:$B$16))

    Copy down until D7


    D9=SUMPRODUCT((ISNUMBER(SEARCH('RAW DATA'!$A$2:$A$16,BUDGET!$B9)))*('RAW DATA'!$B$2:$B$16))
    Last edited by CARACALLA; 09-23-2021 at 04:54 PM.

  10. #10
    Registered User
    Join Date
    09-23-2021
    Location
    Bosnia and Herzegovina ����
    MS-Off Ver
    365
    Posts
    5

    Re: SUM all raw data by code IF main cell contains its code

    Works like a charm! Thank you very, very much - you guys are awesome

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider (Windows 11 64-bit)
    Posts
    52,108

    Re: SUM all raw data by code IF main cell contains its code

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

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  12. #12
    Registered User
    Join Date
    09-23-2021
    Location
    Bosnia and Herzegovina ����
    MS-Off Ver
    365
    Posts
    5

    Re: SUM all raw data by code IF main cell contains its code

    Just one tip for all those who come to this tread looking for the solution to same problem:

    Please make sure that both of your sheets start from the same row, as it is case in mines (e.i. budget calculations and first formula starts from the row 2 in BUDGET sheet, and transactions start from the row 2 as well in the sheet RAW DATA).

    Otherwise formula won't work for this case.

+ 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. [SOLVED] Code to pull data from multiple tabs to main tab by identifier
    By TAMMY32 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-28-2015, 11:49 AM
  2. IMG Code OFF on many Main Forums
    By Doc.AElstein in forum Suggestions for Improvement
    Replies: 1
    Last Post: 09-26-2015, 10:11 AM
  3. Replies: 1
    Last Post: 03-28-2013, 02:49 PM
  4. Macro code to pull the data from different sheets to main sheet
    By Shanthuday in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-14-2012, 09:54 AM
  5. Macro code to pull data from different sheets based on the header of the main sheet
    By Shanthuday in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-21-2012, 05:00 AM
  6. Code to end a main sub before end sub point
    By heliskier89 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-12-2009, 02:04 PM

Tags for this Thread

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