+ Reply to Thread
Results 1 to 17 of 17

subtotal data and include other info from row

  1. #1
    Registered User
    Join Date
    02-03-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    25

    subtotal data and include other info from row

    Short version: I'm trying to find out if there's a way, when using the Subtotal button in Excel 2007 and collapsing the data to level 2, to show more than just the two pieces of information it defaults to (the field you pick under "At each change in:" and the field you check under "Add subtotal to").

    Long version: I have a monthly project that seems to take more time than I think it should, so I'm trying to find quicker ways to handle it. I have a spreadsheet of people who have donated to our organization and it includes some extra information about them such as their ID. I'd like to include the ID, Last Name and First Name in the Level 2 view (so we can manipulate the data in different ways).

    I attached a sample workbook that includes three worksheets that I think are self explanatory.

    If anyone has any idea if this is possible and how I can accomplish it, I'd really appreciate the help.

    Thanks!
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: subtotal data and include other info from row

    Here is what I came up with:

    - For the donation, If used the SUMIF Function
    =SUMIF('original data'!$B$2:$B$26,'what i want it to look like'!F2,'original data'!$C$2:$C$26)

    - For the First and Last Name I used INDEX and MATCH
    =INDEX('original data'!$B$2:$E$26,MATCH(F2,'original data'!$B$2:$B$26,0),3)

    To make the formula simpler I used a helper Column F
    You could do without the helper column, but the formula would be more complex

    Look at the attached spreadsheet

    All the helper column does is strip off the ending word "Total"
    Attached Files Attached Files
    Click on star (*) below if this helps

  3. #3
    Registered User
    Join Date
    02-03-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: subtotal data and include other info from row

    Hi, K m. Thanks for the quick reply.

    I'm trying to replicate what you did as if I was starting from scratch but I'm not having any luck and I think I'm a little confused about the formulas you used and how they work. If you wouldn't mind answering a couple more questions, I'd really appreciate it.

    When I export this list from my database, it has only one worksheet; it comes out looking like the one called "original data". So would my first step be inserting a new blank worksheet and then entering the formulas you came up with (changing the ranges and name of the worksheet as needed)? The columns for ID and Name on Report don't have a formula so I'm not sure how to get that info on the other worksheet.

    Did you use the second worksheet ("after subtotaling") at all or can I just skip that step?

    Thanks!

    PS: I LOVE the helper column removing the word "total"! I was doing it by using search and replace but unfortunately we actually have a couple of companies with "total" in their name and I'd have to remember that and go back and fix it.

  4. #4
    Registered User
    Join Date
    02-03-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: subtotal data and include other info from row

    Hi, K m. Thanks for the quick reply.

    I'm trying to replicate what you did as if I was starting from scratch but I'm not having any luck. I think I'm a little confused about the formulas you used and how they work. If you wouldn't mind answering a couple more questions, I'd really appreciate it.

    When I export this list from my database, it has only one worksheet; it comes out looking like the one called "original data". So would my first step be inserting a new blank worksheet and then entering the formulas you came up with (changing the ranges and name of the worksheet as needed)? The columns for ID and Name on Report don't have a formula so I'm not sure how to get that info on the other worksheet.

    Did you use the second worksheet ("after subtotaling") at all or can I just skip that step?

    Thanks!

    PS: I LOVE the helper column removing the word "total"! I was doing it by using search and replace but unfortunately we actually have a couple of companies with "total" in their name and I'd have to remember that and go back and fix it.

  5. #5
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: subtotal data and include other info from row

    The second worksheet is not needed at all.

    I recommend that you eliminate adding a TOTAL on the end of the entrys. If you want to say Total add that to the column header

    Here is the explanation:
    - The helper column strips away the "Total" from the end. For example: "The ABC Corporation Total"
    becomes "The ABC Corporation"

    - =SUMIF('original data'!$B$2:$B$26,'what i want it to look like'!F2,'original data'!$C$2:$C$26)
    Sum the values in column C2:C26 if they equal F2 . For example, Sum all values for The ABC Corporation
    SUMIF is a lot more powerful than your SUBTOTAL original approach

    - MATCH(F2,'original data'!$B$2:$B$26,0)
    Tell me what row there is a MATCH. For example, which row from original data is The ABC Corporation is on

    - =INDEX('original data'!$B$2:$E$26,MATCH(F2,'original data'!$B$2:$B$26,0),3)
    Give me the first name on the row from the MATCH formula above and column 3.
    In the case of The ABC Corporation that is a blank or zero.
    I changed the worksheet options to suppress zeros, so it shows a blank

    - = INDEX('original data'!$B$2:$E$26,MATCH(F2,'original data'!$B$2:$B$26,0),4)
    This returns the last name. MATCH formula above and column 4


    Hope you can follow this

    Kirk




    -
    Last edited by K m; 01-25-2013 at 04:23 PM.

  6. #6
    Registered User
    Join Date
    02-03-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: subtotal data and include other info from row

    Wow, that was fast! You have no idea how much I appreciate your help, Kirk. These reports are driving me crazy.

    I do understand most of the formulas you used, so that's good, but there are a couple of things I'm not clear on. Let me just ask the first one because it could explain everything else.

    I recommend that you eliminate adding a TOTAL on the end of the entrys. If you want to say Total add that to the column header
    I'm with you on this one. I didn't add that myself, though. Excel does that when it subtotals. But based on your comments, it sounds like I shouldn't bother using the Subtotal button anymore.

    Here is the explanation:
    - The helper column strips away the "Total" from the end. For example: "The ABC Corporation Total" becomes "The ABC Corporation"
    I understand the formula you used in the helper column (F), =LEFT(B2,FIND("Total",B2)-2), but I don't understand how column B got populated in the first place (or column A, for that matter). I don't see anything referencing the "original data" worksheet in column B. Did you just use my data or did you do something tricky that pulled the info from the "original data" worksheet? If you used mine, that's fine, but I used the second spreadsheet ("after subtotalling") to create that list so maybe I do need to keep using the Subtotal button and this report might just be a three-step process.

    Thanks again.

  7. #7
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: subtotal data and include other info from row

    To get column B the way you want with unique values, you need to use another Function such as FREQUENCY.

    Once you have a list of unique Names or ID numbers, the rest relatively easy using INDEX and MATCH {detailed above}.

    Unfortunately I don't the FREQUENCY function well enough to help. Others may help.

  8. #8
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: subtotal data and include other info from row

    I hope I did not confuse things, I used your column A and Column B. I did not generate it. As I mentioned above, To have the computer generate either Column A or Column B would require more work using another formula such as FREQUENCY - I can't help there

    I assume you did not set up the spreadsheet originally. Whoever set it up, did most of the "thinking" for it. For example, they had to decide which numbers to sum. The spreadsheet was not set up to be automated.

    If you know either Column A or B, you could easily generate the other
    ====================================
    There are some smart people on this forum, they can help fill in the missing piece, I don't know

  9. #9
    Registered User
    Join Date
    02-03-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: subtotal data and include other info from row

    That's cool. You did all the hard work for me, maybe I can figure out the frequency function. Okay, probably not, but I bet there's a thread around here somewhere that has some info about it.

    Thanks so much for all your help!

  10. #10
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: subtotal data and include other info from row

    Again, for this one case the second spreadsheet "works" but with different data it would not as it was not set up correctly.

    SUBTOTAL is not the correct function to use, SUMIF is

    Click on the star below if this was helpful

  11. #11
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: subtotal data and include other info from row

    A quick review of the web shows you can extract unique names using a PIVOT TABLE

  12. #12
    Registered User
    Join Date
    02-03-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: subtotal data and include other info from row

    Quote Originally Posted by K m View Post
    I assume you did not set up the spreadsheet originally. Whoever set it up, did most of the "thinking" for it. For example, they had to decide which numbers to sum. The spreadsheet was not set up to be automated.
    Nope, it was me and it was automated. I just used the Subtotal button on the Data tab under Outline, it just didn't give me all the info I wanted.

  13. #13
    Registered User
    Join Date
    02-03-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: subtotal data and include other info from row

    Quote Originally Posted by K m View Post
    A quick review of the web shows you can extract unique names using a PIVOT TABLE
    I played around with a pivot table for about 15 minutes but it was creating two rows for each name and we didn't want that. I'll spend some more time with it (and maybe the FREQUENCY function you mentioned) this weekend from home where it's not as loud and busy and I can actually get some thinking done.

    Thanks!

  14. #14
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: subtotal data and include other info from row

    I was able to solve the problem using an array and I fixed the error from last week.

    Try this:


    If you want to know more information on how I retrieved the unique list of company names follow this link:

    http://www.get-digital-help.com/2009...om-one-column/
    Attached Files Attached Files
    Last edited by K m; 01-28-2013 at 08:33 AM.

  15. #15
    Registered User
    Join Date
    02-03-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: subtotal data and include other info from row

    This looks really helpful and exactly what I need. I have to learn more about arrays to really understand what you did so I bookmarked that link you provided to check out later.

    Thank you so much for your help! I'm really grateful that you managed to take my multi-step method (that wasn't even giving me everything I wanted) and turn it into pretty much a one-step process.

  16. #16
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: subtotal data and include other info from row

    If this solved your problem, click on the star at the bottom of this message and change the title to [SOLVED]

    The link explains it better than I would have

  17. #17
    Registered User
    Join Date
    02-03-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: subtotal data and include other info from row

    Oops! I gave you reps on one of your other posts in this thread so I can't do it again until I spread some around. But I did mark the thread solved and I'll go back to any old questions I asked and do the same.

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