+ Reply to Thread
Results 1 to 1 of 1

Sum cells based on whether another cell has a value, then repeat?

  1. #1
    Registered User
    Join Date
    11-25-2009
    Location
    Oregon
    MS-Off Ver
    Excel 2003
    Posts
    4

    Sum cells based on whether another cell has a value, then repeat?

    Excel 2003--I have a worksheet that's exported from another program and isn't formatted in a way that allows me to sort and sum.

    In a nutshell, I want to put a formula in column B that will sum numbers in column G based on whether there's a number in column D, and repeat that for each time a number appears in column D. A workbook is attached.

    Column A lists members; members may have more than one user associated with their membership.

    Column C lists account numbers; there is one account number per member. However, column C also lists the birthdate of each user where the user name appears in column A.

    Column D lists the year-to-date transaction total. This is the only value in column D and it appears on the first line of that member's list of transactions.

    Column G lists the transaction amounts for each user.

    In the attached workbook, G2, G5, and G8 are transactions for Jane Public (a user on Joe Public's membership); G11 and G14 are transactions for Joe Public); and G17 and G20 are transactions for Sue Public (a user on Joe Public's membership). G23 is the transaction for Doug Doe. G26 and G29 are transactions for Betty Smith (a user on John Smith's membership); G32 and G35 are transactions for John Smith.

    I want, if possible, to put a formula in B2 that says "If D2 has a value in it, sum the cells in column G starting with row 2 and as long as the cells below D2 are blank and display that sum here. Don't display anything in B2 if D2 is blank. Repeat this when the next value in D is encountered."

    So if I put that formula in B2, it would see that there's a formula in D2 and display, in B2, the sum of G2:G22 (transactions for the Joe Public membership, which incorporate the transactions for Jane, Joe and Sue). If I put it in B3, it would display nothing in B3 because there's no value in D3. If I put it in B23, it would see that there's a formula in D23 and display, in B23, the sum of G23:G25 (transactions for the Doug Doe membership).

    I would expect to find B2 showing $42.00, B23 showing $3.00, and B26 showing $911.00.

    Is there a way to do this with a formula that I can put in B2 and copy down the column? Currently I'm manually putting =SUM(G2:G22) in B2, =SUM(G23:G25) in B23, etc. and as it's a lengthy report it's pretty tedious. Any solutions or suggestions much appreciated!
    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