+ Reply to Thread
Results 1 to 14 of 14

Sum a formula result over a range of cells

Hybrid View

  1. #1
    Registered User
    Join Date
    01-25-2013
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Question Sum a formula result over a range of cells

    Hello all,

    I have one column that marks attendance, N, (indicated by "1") and a corresponding column that denotes gender, D. I want to calculate the M:F ratio at each event. The aim of this formula is to tally the number of Males (M) present at the event.

    This is the formula I currently have

    =IF(ISNUMBER(MATCH(1,N12,0)),(COUNTIF(D12,M)),0)

    The problem is I want to SUM the result of this calculation for rows 12-25, without retyping the formula over and over again. Any suggestions would be helpful.

    Thank you in advance, Allison.

  2. #2
    Valued Forum Contributor
    Join Date
    11-20-2012
    Location
    Seattle, WA USA
    MS-Off Ver
    Excel 2010
    Posts
    597

    Re: Sum a formula result over a range of cells

    why can't you just copy the formula down? click on the cell with the formula, look at the lower right corner of the selected cell, you will see a little square box, put your mouse over it and drag it down

    alternatively you can copy and paste

    or copy and paste special formula in to the appropriate cells

  3. #3
    Valued Forum Contributor
    Join Date
    11-20-2012
    Location
    Seattle, WA USA
    MS-Off Ver
    Excel 2010
    Posts
    597

    Re: Sum a formula result over a range of cells

    p.s. your formula should be =IF(ISNUMBER(MATCH(1,N12,0)),(COUNTIF(D12,"M")),0) (the M should be in " ", otherwise it will give you a 0 as the result)

  4. #4
    Valued Forum Contributor
    Join Date
    11-20-2012
    Location
    Seattle, WA USA
    MS-Off Ver
    Excel 2010
    Posts
    597

    Re: Sum a formula result over a range of cells

    i'm guessing you're new to excel?

    if so this is a great youtube library called excelisfun that has helped me with some very useful tricks as well as super advanced functions, it runs the spectrum of beginner to super advanced users

    http://www.youtube.com/user/excelisf...e=results_main
    Last edited by scott.s.fower; 01-25-2013 at 08:39 PM.

  5. #5
    Registered User
    Join Date
    01-25-2013
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Sum a formula result over a range of cells

    I am looking for a total attendance, rather than a list of zeros and ones.

    Thank you for that catch, on my sheet "M" is actually a cell that I use as a key. The formula works fine, I just want a way to sum the number of "M" in column D, but onl if there is a "1" in column N.

    The closest formula I can get is

    =SUM(IF(ISNUMBER(MATCH(1,N12,0)),(COUNTIF(D12,M)),0), =IF(ISNUMBER(MATCH(1,N13,0)),(COUNTIF(D13,M)),0), =IF(ISNUMBER(MATCH(1,N14,0)),(COUNTIF(D14,M)),0), =IF(ISNUMBER(MATCH(1,N15,0)),(COUNTIF(D15,M)),0), =IF(ISNUMBER(MATCH(1,N16,0)),(COUNTIF(D16,M)),0), etc)... however I feel like there should be an easier way.

  6. #6
    Registered User
    Join Date
    01-25-2013
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Sum a formula result over a range of cells

    The countifs works!! Thank you so much guys, you have no idea how many different variations of formulas I tried. You are all the best. Allison

  7. #7
    Registered User
    Join Date
    10-25-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2007
    Posts
    71

    Re: Sum a formula result over a range of cells

    The other problem I noticed with your formula is you may be missing the quotations around the M.

    =IF(ISNUMBER(MATCH(1,N12,0)),(COUNTIF(D12,"M")),0)
    after you copy and paste that into all of your cells. You can do a sum function on all to get a count of all males who were present.

    Or alternatively you can use this formula;

    =COUNTIFS(D2:D37,"M",N2:N37,1)
    The COUNTIFS function was introduced in Excel 2007. It allows you to specify several criteria. In this example D2:D37 is the range of cells to look for a text value of M. And then it examine ranfe N2:N37 for a 1. If both of the criteria are true it adds to a count. It will examine the entire range you specify. You can change the formula easily to point to a different range of cells or the value you are looking for.

  8. #8
    Forum Contributor
    Join Date
    04-01-2009
    Location
    Irvine, CA
    MS-Off Ver
    Excel 2010
    Posts
    280

    Re: Sum a formula result over a range of cells

    If you are looking for the total number of Males in a single formula you can use =SUMIFS(N:N,D:D,"M") assuming attendance (N) is 1 or 0 or you can use =COUNTIFS(N:N,1,D:D,"M") in both cases you can substitute a specific range for the column (i.e. - instead of N:N use N2:N100).

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Sum a formula result over a range of cells

    Thanks the tip, scott, I will be sure to check it out
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  10. #10
    Registered User
    Join Date
    10-25-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2007
    Posts
    71

    Re: Sum a formula result over a range of cells

    Can you post a copy of your spreadsheet with fake information? It may be easier for us to assist if we understand better.

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Sum a formula result over a range of cells

    You are using 2007, it has a new function called sumifS(), which allows you to specifiy a whole bunch of different criteria. Im not sure what your data looks like, but give this a shot. the syntax is...

    =sumifs(sum-range,criteria1-range,criteria1,criteria2-range,criteria..................)

  12. #12
    Valued Forum Contributor
    Join Date
    11-20-2012
    Location
    Seattle, WA USA
    MS-Off Ver
    Excel 2010
    Posts
    597

    Re: Sum a formula result over a range of cells

    glad we could help you Allison, this is the place to get excel help!

  13. #13
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Sum a formula result over a range of cells

    Try it like this:

    =COUNTIFS(N12:N16,1,D12:D16,"M")

  14. #14
    Valued Forum Contributor
    Join Date
    11-20-2012
    Location
    Seattle, WA USA
    MS-Off Ver
    Excel 2010
    Posts
    597

    Re: Sum a formula result over a range of cells

    from her original post, it sounds like its either 1 or nothing, so i don't think she needs to sumifs(), but i could be wrong

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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