+ Reply to Thread
Results 1 to 2 of 2

Excel 2007 : Sum range only if adjacent range contains identical values?

  1. #1
    Registered User
    Join Date
    10-07-2010
    Location
    New York, New York
    MS-Off Ver
    Excel 2003
    Posts
    1

    Sum range only if adjacent range contains identical values?

    Can anyone tell me if there is a way to sum one range of values depending on the contents of another range?

    For example, lets say my spreadsheet has 4 columns:

    -Column A has the name of the customer/company.
    -Column B has the account numbers.
    -Column C has each account's usage.
    -Column D has usage totals (this is where I need help)

    Companies/Customers often have more than one account and I need the sum of all the usages for accounts belonging to the same customer. Repeat customer names are always listed consecutively, ie if John has 5 accounts, A1:A5 will say "John".
    Account numbers are each unique.
    So... if A1:A5 says "John", I would like each cell in range D1:D5 to show the sum of C1:C5.

    I know how to do all of this with defined criteria, ie if it were only three repeating customers... But we have an infinite number of customers and I need excel to group one range based on grouped values in another. In other words, if, a1:a5 contains "John" and a6:a8 contains "Bob", I want for it to sum only the John accounts together and then the Bob accounts together. Does that make sense?

    If anyone could help, I would be infinitely grateful!! (I'm not so familiar with VBA and would of course prefer an Excel formula, but if there is a very SIMPLE VBA solution I can probably do it.)

    Thanks!!

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Sum range only if adjacent range contains identical values?

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!

+ 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