+ Reply to Thread
Results 1 to 11 of 11

Sum function based off another cell

  1. #1
    Registered User
    Join Date
    11-18-2009
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    29

    Sum function based off another cell

    I have a spreadsheet of customers and their most recent statement balance. There is also another column with codes we use to track customers. I would like to have a sum formula that adds all of the balances in column F, but leave out the balances that are coded B0, B1, B3 and B7, which are located in column B. Could someone help me understand how I need to do the formula?

    Thanks.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Sum function based off another cell

    You could use a formula like this:

    =SUM(F:F) - SUMIF(B:B,{"B0","B1","B3","B7"},F:F)

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    11-18-2009
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    29

    Re: Sum function based off another cell

    Thanks. I wanted to get a bit more specific and I tweaked your formula a bit and now it doesn't work. I don't need the entire B and F columns, just a range. I also forgot about a couple of more codes, so I added those. Did I mess something up or why isn't it working?

    =SUM(F9:F705) - SUMIF(B9:B705,{"B0","B1","B2","B3","B4","B7","BD"},F9:F705)

  4. #4
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Sum function based off another cell

    What do you mean by " it doesn't work"?

  5. #5
    Registered User
    Join Date
    11-18-2009
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    29

    Re: Sum function based off another cell

    Sorry, I should have elaborated. When I tweaked the formula to the one I posted, it just displays the formula in the cell, it doesn't do any calculation.

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Sum function based off another cell

    I can't get it to work either.

    I did get this to work:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The B* is a criteria for everything that starts with B
    Last edited by newdoverman; 11-18-2013 at 08:09 PM.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  7. #7
    Registered User
    Join Date
    11-18-2009
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    29

    Re: Sum function based off another cell

    I get the same result with that formula, too. When I paste it and hit Enter, it just displays the formula.

    Edit:
    One thing I didn't think of was, this is a spreadsheet that I converted from PDF. I converted it to a txt file and then imported it using the Data tab. Could that be why nothing is working?

  8. #8
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Sum function based off another cell

    It would appear that your worksheet is TEXT so formulae will only show as formulae and not do calculations.

  9. #9
    Registered User
    Join Date
    11-18-2009
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    29

    Re: Sum function based off another cell

    Goodnees gracious, I'm a moron. Now the formula is working perfectly. Thank you so much for your help.

    Just for clarification, the number that's returned is the total amount of balances that have a code that begins with B, correct?

  10. #10
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Sum function based off another cell

    Quote Originally Posted by jeffv View Post
    Just for clarification, the number that's returned is the total amount of balances that have a code that begins with B, correct?
    No. This part of the formula that Ron suggested:

    SUMIF(B9:B705,"B*",F9:F705)

    gives you that, but it is subtracted from the sum of ALL values in the range, so the result is the opposite of what you stated.

    Hope this helps.

    Pete

  11. #11
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Sum function based off another cell

    =SUM(F9:F705) - SUMIF(B9:B705,"B*",F9:F705)

    =SUM(F9:F705) This part sums the total for the column

    -SUMIF(B9:B705,"B*",F9:F705) This part sums everything that begins with B and in the formula, subtracts this amount from the total thus giving you the sum of everything minus the codes that start with B.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. if function based on cell value and date of another cell
    By ea223 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-17-2012, 06:03 PM
  2. Replies: 6
    Last Post: 08-28-2012, 06:51 PM
  3. Replies: 2
    Last Post: 06-08-2011, 02:36 PM
  4. Replies: 4
    Last Post: 12-14-2007, 05:39 PM

Tags for this Thread

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