+ Reply to Thread
Results 1 to 6 of 6

Allocating DIvision spending to project (2 tables to 1)

  1. #1
    Registered User
    Join Date
    07-03-2010
    Location
    london, england
    MS-Off Ver
    Excel 2004
    Posts
    27

    Allocating DIvision spending to project (2 tables to 1)

    Attached is a Sample document. I use VB pretty often just to do simple things like making a command to convert formulas to values and always having the active cell's row highlighted. This is a little bit harder, and I can't seem to figure out anywhere to start. Any help would be appreciated.

    Document: (also attached): http://www.mediafire.com/?d4zy1jrz3ti

    I have how much money departments spent each quarter, and another table that has the what projects each department was working on. I basically need to break up the money spent into specific projects.

    Here is an example (this data is highlighted in red in the sample document):

    Data to be organized:
    Please Login or Register  to view this content.
    And in Breakdown I have the following lines with Division ‘Candy Making’:
    Please Login or Register  to view this content.
    The resulting data (in a new sheet): should be:
    Please Login or Register  to view this content.
    It basically made a line for each project in ‘Breakdown’ that contains division ‘Candy Making’, copied the area (‘Around) along with division (‘candy making’) and project (X5555 and PLMN), it then multiplied the ratio of each project to the Q1 spending in ‘Data to be organized’. So I took 8/9 [9 is the sum all the projects in the division]*100 and then 1/9*100.

    Note: Area doesn't matter to the allocation but it needs to be carried along with the data to the new sheet, and there may be the same department with different areas that need their own lines (but are allocated with the same breakdown)
    Attached Files Attached Files
    Last edited by minimacros; 07-04-2010 at 12:57 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Allocating DIvision spending to project (2 tables to 1)

    To replicate your expected results with one common formula for entire matrix, without use of helper cells, you would be looking at something like:

    Please Login or Register  to view this content.
    The above is not particularly efficient however ... used against large data sets it will perform poorly.

    If you can use helpers let us know as you will be able to improve the efficiency of the calculations.

  3. #3
    Registered User
    Join Date
    07-03-2010
    Location
    london, england
    MS-Off Ver
    Excel 2004
    Posts
    27

    Re: Allocating DIvision spending to project (2 tables to 1)

    Hey thanks for the response, reading up on SUMPRODUCT right now, seems like a helpful command. The formula works well assuming I have the columns (A,B,C) Area, Division, & Project already filled in, the problem is I dont have that sheet at all.

    I do really appreciate your help on this one.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Allocating DIvision spending to project (2 tables to 1)

    Per the note at MrExcel - if you x-post in multiple forums ensure you provide links accordingly

    http://www.mrexcel.com/forum/showthread.php?t=478832

    we ask you divulge links so as to prevent/limit possibility of members wasting their free time composing a solution to a problem which may have been resolved elsewhere.

    Neither forum in this case precludes x-posting (many do) but both do ask you follow this very simple rule.

    Quote Originally Posted by minimacros
    The formula works well assuming I have the columns (A,B,C) Area, Division, & Project already filled in, the problem is I dont have that sheet at all.
    I might be mistaken but isn't End Result [Cols B & C] simply a copy of Breakdown ? Albeit with a 1:1 assumption made between Project & Area which can be calculated [Col A] from data per the 'Data to be Organized sheet' ?

    Depending on Volume of data it would be quite a trivial exercise to setup End Result in lieu of the data in the data sheets (ie use pre-emptive ifs to determine as to whether or not data is to be returned for any given row)

  5. #5
    Registered User
    Join Date
    07-03-2010
    Location
    london, england
    MS-Off Ver
    Excel 2004
    Posts
    27

    Re: Allocating DIvision spending to project (2 tables to 1)

    First off: Thank you for linking the two posts, I am sorry I did not link them beforehand.

    2nd: I did not full understand your post but there can definitely be the same division in different areas. Areas is more like travel expense, equipment expense etc. There can also sometimes be repeats of area/division combinations. The formula you guys gave me will help cut down the work a good amount, but unfortunately there are thousands of lines of data as it is very poorly managed. This would still require manually putting in tons of lines to match up the divisions to the projects.

  6. #6
    Registered User
    Join Date
    07-03-2010
    Location
    london, england
    MS-Off Ver
    Excel 2004
    Posts
    27

    Re: Allocating DIvision spending to project (2 tables to 1)

    Wow thanks for the help so far guys. I have finally understood the formula (for the most part) and have noticed it is great once the left 3 fields are set up correctly. The only problem with the formula is that the combination of area and division is NOT unique. So for instance there can be multiple entries with the same division and area... This formula will always only get the data from the first line.

    Of course the other problem is combining the 2 sets of data. I figured the easiest way to solve the dilemma is to edit the formula so that it searches the 'Data to be Organized' for identical entires (in Column A & B) and then sum them up, then multiply through instead of just search for the first entry that matches columns A & B. Then the only problem would be to get the first 3 columns ordered correctly. I have started doing a Macro but am, unfortunately, not that good. Here is the code (The attached document has the formula from above posted in the results sections and the macro I have started).

    It would be great to get a little help in fixing up this formula so it correctly finds each instance of division and area (as I have not been able to get it to correctly work) and also to have the macro perform correctly, and only copy one instance of each division/area section (right now it is only doing line 3, I'm not sure exactly how to get it to do each unique line, I've tried a For Each x In ... but am not that versed in the area). Thank you very much for all your help


    On a side note: what are the two dashes scattered around the function shown above for?

    Please Login or Register  to view this content.
    Also note the Macro doesn't fill in all of column A (I am trying, I promise... I am new and learning)
    Attached Files Attached Files

+ 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