+ Reply to Thread
Results 1 to 5 of 5

Count and sum values in two columns for each particular value in a third column

  1. #1
    Registered User
    Join Date
    02-28-2012
    Location
    Athens, GA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Count and sum values in two columns for each particular value in a third column

    Hi. So what I need to do is very simple, but I'm not sure where to start.

    I have the following:

    County 2010 2011
    A1 x
    A1 x x
    B2 x
    B2 x
    B2
    C3 x x
    C3 x
    D4 x x
    E5 x

    I need to be able to calculate how many times each county has a value (i.e., not blank) in 2010, and then again in 2011. In my real spreadsheet, each county might be on there 1 time, 5 times, or 50 times. At the end of the day, I want my formula to be able to calculate that, for example, county A1 has 2 inputs in 2010 and 1 input in 2011; and that B2 has 1 input in 2010 and 1 input in 2011.

    Does this make any sense? Thanks for any help.
    Last edited by askantik; 02-28-2012 at 12:49 PM.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Count and sum values in two columns for each particular value in a third column

    Hi Askantik, welcome to the forum.

    You should be able to use COUNTIF formulas, e.g.

    =COUNTIFS(A1:A100,"B2",B1:B100,"x")

    That will count every instance where county B2 has an "x" in column B (2010). Change B1:B100 to C1:C100 for 2011 totals.

    You could also use a PivotTable, which would make it quick to get your totals.

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Count and sum values in two columns for each particular value in a third column

    You could do this with a simple Pivot Table, I think.

    Select the range and go to Insert|Pivot Table

    Select where you want it to go, click Ok.

    Then drag Country down to Row Labels section, drag 2010 and 2011 each to the Summation area.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Count and sum values in two columns for each particular value in a third column

    Hi(Καλησπέρα) and welcome to the forum.

    Try this.

    =SUMPRODUCT(($A$2:$A$10=A2)*($B$2:$B$10="x"))

    As you have Excel2010, you can do this with COUNTIFS, TOO.

    Hope to helps you.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  5. #5
    Registered User
    Join Date
    02-28-2012
    Location
    Athens, GA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Count and sum values in two columns for each particular value in a third column

    Thanks for the responses. NBVC's suggestion of the pivot table was exactly what I needed and it didn't care that the values themselves were different-- just that there was a value, which was key to what I needed.

    Thanks again.

+ 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