+ Reply to Thread
Results 1 to 8 of 8

Sum Product (Comparing Multiple Columns and Counting Sum

  1. #1
    Forum Contributor
    Join Date
    02-10-2007
    MS-Off Ver
    Excel 2010
    Posts
    293

    Sum Product (Comparing Multiple Columns and Counting Sum

    Hello,

    I think I need to use a sumproduct, but not sure. Please see attached spreadsheet.

    Here's what I'm trying to find:

    Compare Column F to Column A
    Column G should be sum the # of times the value in Column A is used with Column C

    Desired Result in Column G, where formula should go.

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Sum Product (Comparing Multiple Columns and Counting Sum

    I believe you just need this

    =COUNTIF(A:A,F2)

  3. #3
    Forum Contributor
    Join Date
    02-10-2007
    MS-Off Ver
    Excel 2010
    Posts
    293

    Re: Comparing Multiple Columns and Counting Sum

    Hi Cutter,

    I gave a bad example..let me try again..please see new attachment.

    Here's what I'm trying to do

    Results are in Column F & G which I'm trying to solve formula for

    Column G, sum total # of unique domains, in column c, that are associated with column a, after looking at column e
    Column F, count total # of pages, after looking at column e, that are associate with column a, which i belive you're formula

    COUNTIF(A:A,E2) which would go in to f2 would work.


    Its column g, that I'm trying to solve..

    Desired result is in columns f & g

    Thanks for your help.
    Attached Files Attached Files

  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: Sum Product (Comparing Multiple Columns and Counting Sum

    Ηι

    A way to do this not using cell reference,is this.

    =COUNTIF(C:C,"*redpony*")

    Hope that 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
    Forum Contributor
    Join Date
    02-10-2007
    MS-Off Ver
    Excel 2010
    Posts
    293

    Re: Sum Product (Comparing Multiple Columns and Counting Sum

    Hi Fortis,

    I will need to use cell references, as i have a very large data set, and also looking for exact matches not *, thus can't type in manually values in each cell. But appreciate you're help.

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Sum Product (Comparing Multiple Columns and Counting Sum

    Perhaps this array formula in G2 and copied down

    =SUM(N(FREQUENCY(IF(A$2:A$10=E2,MATCH(C$2:C$10,C$2:C$10,0)),MATCH(C$2:C$10,C$2:C$10,0))>0))
    confirmed with Ctrl+Shift+Enter (instead of just Enter)
    Last edited by Cutter; 06-02-2012 at 07:07 PM.

  7. #7
    Forum Contributor
    Join Date
    02-10-2007
    MS-Off Ver
    Excel 2010
    Posts
    293

    Re: Sum Product (Comparing Multiple Columns and Counting Sum

    Thanks Cutter. It worked perfectly. Feel free to pm me to paypal you.

    Perhaps you could explain in plain english..how it works..

    1. IF(A$2:A$10=E2,MATCH(C$2:C$10,C$2:C$10,0)),MATCH(C$2:C$10,C$2:C$10,0))>0) ....if(a2:a10=e2, then match(c2:c10) ((looks and finds position # of the value), if the value is not then MATCH(C$2:C$10,C$2:C$10,0))>0, basically add a 1 for the value
    2. Frequency....

    ?

  8. #8
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Sum Product (Comparing Multiple Columns and Counting Sum

    Select cell G3 and, in the formula bar, highlight this portion of the formula: IF(A$2:A$10=E3,MATCH(C$2:C$10,C$2:C$10,0))
    Hit F9 key and you'll see this result: {FALSE;FALSE;3;4;5;6;5;FALSE;FALSE}
    This serves as the data array for the FREQUENCY() function.
    Click Esc key and highlight this portion (after what was just highlighted): MATCH(C$2:C$10,C$2:C$10,0)
    Again, hit the F9 key and you'll see this result: {1;2;3;4;5;6;5;8;9)
    This is the bins array for the FREQUENCY() function.
    Click the Esc key again and now highlight the FREQUENCY portion: FREQUENCY(IF(A$2:A$10=E3,MATCH(C$2:C$10,C$2:C$10,0)),MATCH(C$2:C$10,C$2:C$10,0))
    Again hit the F9 key and you'll see: {0;0;1;1;2;1;0;0;0;0}
    The FREQUENCY() function has looked at the results of the 2 MATCH() functions and said that there is 1 x 3, 1 x 4, 2 x 5 and 1 x 6 (and none of the others)
    Hit Esc and now highlight everything between the brackets of the SUM() function
    The N() function has converted TRUE/FALSE values to 1/0 for the statement >0 so you get: {0;0;1;1;1;1;0;0;0;0} instead of {FALSE;FALSE;TRUE;.........}
    And finally the SUM() function just adds up those 1's and 0's and arrives at 4

    Here are links to read for the FREQUENCY() function:
    http://www.excelfunctions.net/Excel-...-Function.html
    http://office.microsoft.com/en-us/ex...in=HP010079186

+ 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