+ Reply to Thread
Results 1 to 4 of 4

Sum cells IF row contains certain number?

  1. #1
    Registered User
    Join Date
    12-12-2013
    Location
    Delft, The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    1

    Sum cells IF row contains certain number?

    Hi all,

    I have an issue with a table. I want to sum cells of a certain column if the row contains a certain number. I uploaded a worksheet with the issue.

    In the worksheet I want to sum the cells of the columns “Monday, Tuesday, etc.” per class the group belongs to. To clarify it, I added colors to the cells I want to sum and the place where I want the total of that sum. So for cell B13, I want to add all the amounts on “Monday” which are in a row where the H-column contains a 1. For cell B14, I want to add the amounts of column B where the H-column contains a 2, and so on.

    I found a way to do it, but it’s such a long formula that it isn’t practical for a large table. What works for cell B13 is: =IF(H4=1|B4)+IF(H5=1|B5)+(H6=1|B6)+(H7=1|B7)+(H8=1|B8)+(H9=1|B9)+(H10=1|B10)+(H11=1|B11)

    There must be an easier way and I hope you can help me find it. Thanks in advance.

    Sorry for my bad English, I tried to be as clear as I could.
    Attached Files Attached Files

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,686

    Re: Sum cells IF row contains certain number?

    try a sum if
    =SUMIF($H$4:$H$11,1,$B$4:$B$11)

    change the
    =SUMIF($H$4:$H$11,1,$B$4:$B$11)
    1 for each class
    1,2,3

    you could also use the title to do that if you have lots of classes

    =SUMIF($H$4:$H$11,RIGHT(A18,1),$B$4:$B$11)

    here I use
    RIGHT(A18,1)
    to get the last character of the title and use that as a criteria

    see attached
    Attached Files Attached Files
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,767

    Re: Sum cells IF row contains certain number?

    In B13 Cell

    =SUMIF($H$4:$H$11,VALUE(TRIM(SUBSTITUTE(UPPER(A13),"TOTAL CLASS",""))),$B$4:$B$11)

    Drag it down...


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Registered User
    Join Date
    12-12-2013
    Location
    Delft, The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Sum cells IF row contains certain number?

    Hi etaf,

    Worked perfectly! Thanks for your help!

  5. #5
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,686

    Re: Sum cells IF row contains certain number?

    excellent , thanks for letting us know

    if my assistance has helped, and only if you wish to , there is a reputation icon * on the left hand side - you can add to my reputation here
    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

+ 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. how to decrease one cells number while increasing another cells number
    By raffi123 in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 06-12-2013, 04:31 PM
  2. Replies: 0
    Last Post: 09-06-2012, 10:41 AM
  3. Add a preset number of cells after unknown number of leading zeroes
    By Marweas in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-24-2012, 09:23 PM
  4. Replies: 4
    Last Post: 01-02-2007, 07:50 AM
  5. Count number of times a specific number is displayed in cells
    By subs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-27-2005, 11:05 AM

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