+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : sumifs inside of a vlookup ?

  1. #1
    Registered User
    Join Date
    04-20-2011
    Location
    nashville, tennessee
    MS-Off Ver
    Excel 2007
    Posts
    33

    sumifs inside of a vlookup ?

    I have attached a test worksheet with the desired results on the first page. Columns B & C would normally be blank.

    I need to lookup the ID on sheet 2, sum the transaction total for each unique size and return the size code along witht the sum for that size code.
    Attached Files Attached Files
    Last edited by budchevy; 05-15-2011 at 06:33 PM.

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: sumifs inside of a vlookup ?

    Try this workbook.

    The simplest way to get your result is to use SUBTOTAL in Sheet2 then filter by "Style Code" then by column "Size Code"
    This is also versitile
    You can then SUM by styles, or sizes, or any combination that might interest you.
    In E1
    Please Login or Register  to view this content.

    If you must split the "Style Code" into unique Code and Size, then it might be tricky to get a formula for Column "Style Code".
    At this stage let's assume you have generated Column A manually

    In B2
    Please Login or Register  to view this content.
    In C2
    Please Login or Register  to view this content.
    Drag/Fill both Down.

    Hope this helps

    [EDIT]
    Here is one way to generate a unique list of "Style ID" and "Sizes" (see "Sheet3")
    First sort your data by "Style Code" then by column "Size Code"

    Use two Helper Columns A & B. (these can be hidden with the grouping button +/-)
    In A2
    Please Login or Register  to view this content.
    Drag/Fill Down until the formula returns a null string i.e. ""
    In B2
    Please Login or Register  to view this content.
    Drag/Fill Down until the formula returns a null string i.e. ""
    In C2 This will generate the code and put it in the correct number of rows ot match the number of sizes.
    Please Login or Register  to view this content.
    Drag/Fill Down
    Columns D & E are the original formulae re-referenced and nested in an if statement to ignore blank rows.

    I have updated the attachment.
    Attached Files Attached Files
    Last edited by Marcol; 05-11-2011 at 06:46 AM. Reason: Updated reply before OP responded.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  3. #3
    Registered User
    Join Date
    04-20-2011
    Location
    nashville, tennessee
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: sumifs inside of a vlookup ?

    Marcol,

    Been putting this together on my actual data and It works, but for only the first style ID. Once I drag down the formulas on my data, which has hundreds of unique style ID's, I get a bunch of size entries that dont' exist.I think the reason may be that I have multiple entries for the same style ID and size code.

    I have copied some of my data onto the spread sheet you submitted.
    Attached Files Attached Files
    Last edited by budchevy; 05-12-2011 at 05:31 PM.

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: sumifs inside of a vlookup ?

    Try this workbook.

    1/. There was an error in your workbook when the formula in Sheet3 B2 was copied and the range referenced needed to be adjusted. The original sample had less than 30 rows and the formula was based on that.
    This in B2 covers up to 1000 rows
    Please Login or Register  to view this content.
    If you have more than 1000 rows adjust this (2 instances)
    Please Login or Register  to view this content.
    to cover your needs and a bit more.
    Do similarly with the formula in F2 with 3 places

    2/. The original sample indicated that sizes began with size 1. In the new sample some begin at size 0
    This in E2 allows for that and for sizes 00, 000, 10, etc.
    Please Login or Register  to view this content.

    3/. I have added another helper column, Column C, that finds the first row for each style, and another to sub-total each style.
    In C2
    Please Login or Register  to view this content.
    Then in G2
    Please Login or Register  to view this content.

    4/. The SUBTOTAL() method still works, Sheet2, although you might need to adjust the formula in E1 to cover more than 1000 rows.
    e.g.
    Please Login or Register  to view this content.

    Hope this helps
    Attached Files Attached Files
    Last edited by Marcol; 05-13-2011 at 05:16 AM. Reason: Further Clarification Added

  5. #5
    Registered User
    Join Date
    04-20-2011
    Location
    nashville, tennessee
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: sumifs inside of a vlookup ?

    Genius work Marcol.. Had 2600 lines in the real data set and once I made the changes you talked about I was able to get it to work.. I also just removed sheet1 and used the additional cells you added to sheet3 as the view the user will see.

+ 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