+ Reply to Thread
Results 1 to 7 of 7

Countifs matching rows and column values

  1. #1
    Registered User
    Join Date
    05-02-2017
    Location
    London
    MS-Off Ver
    2016
    Posts
    6

    Countifs matching rows and column values

    Hi,

    I have a datatable of people who signed up to attend a show. My data includes the attendence type and the newspapers they have been reading.
    I am trying to count the True values per newspaper and attendence status using countifs individually. But I was wondering if I can use offset formula maybe.

    My data table looks like this

    Atts type Ny times Financial times Daily Metro Sun
    Attendee True True
    Non-atts True True
    Non-atts True True
    Attendee True True
    Non-atts True
    Attendee True True
    Attendee True True


    I am trying to count how many of those reading each newspaper attended or non-attended the exhibition.

    Non-attendee % Non attendee % conversion%
    Ny times
    Financial times
    Daily
    Metro
    Sun

    Thanks
    Attached Files Attached Files
    Last edited by Excelmagster; 07-05-2017 at 06:50 AM.

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Countifs matching rows and column values

    1. First remove the spaces after Attendee and Non-atts in column A so things match.
    (This created a long delay with zeroes appearing which didnt make sense, I could have had this done twenty minutes earlier).

    2. in A11
    =IFERROR(INDEX($B$1:$E$1, MATCH(0, COUNTIF($A$10:A10, $B$1:$E$1), 0)),"")
    Array formula, use Ctrl-Shift-Enter
    copy down the column a few rows

    3. in B10 put Attendee (dont put any spaces in)
    4. in C10 put Non-atts (don't put any spaces in)

    5. in B11
    =SUMPRODUCT(($A$2:$A$8=B$10)*(B$1:E$1=$A11)*(B$2:E$8))
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,169

    Re: Countifs matching rows and column values

    See attached.

    in H2

    =COUNTIFS($A$2:$A$8,H$1,INDEX($B$2:$E$8,,MATCH($G2,$B$1:$E$1,0)),TRUE)

    Ensure all leading/trailing blanks are removed from text titles
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    05-02-2017
    Location
    London
    MS-Off Ver
    2016
    Posts
    6

    Re: Countifs matching rows and column values

    Thank you John. this has worked. But confused how the second criteria works
    Apologies, attached was just a sample file, missed out on removing leading and trailing spaces.
    I was wondering if you could explain the second criteria used in the countifs formula if possible
    =COUNTIFS($A$2:$A$8,H$1,INDEX($B$2:$E$8,,MATCH($G2,$B$1:$E$1,0)),TRUE)


    Thanks again
    Last edited by Excelmagster; 07-05-2017 at 10:45 AM.

  5. #5
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Countifs matching rows and column values

    Who are you talking to John or myself?
    If me then you'll need to describe "second criteria"?

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,169

    Re: Countifs matching rows and column values

    I think it is me to explain the COUNTIFS:

    =COUNTIFS($A$2:$A$8,H$1,INDEX($B$2:$E$8,,MATCH($G2,$B$1:$E$1,0)),TRUE)

    INDEX format is INDEX(Range,row,column)

    You will see in the above the range is B2:E8, no row, (indicated by "blank" between the two commas) and column is the MATCH function


    The INDEX "criteria" selects the column corresponding to the paper by MATCHing the newspaper title in column G against the headings in row 1, starting column B.

    So "NY times" will return a value of 1 so the criteria range is B2:B8: for "Metro Sun" the returned value will be 4 so the criteria range is E2:E8

  7. #7
    Registered User
    Join Date
    05-02-2017
    Location
    London
    MS-Off Ver
    2016
    Posts
    6

    Re: Countifs matching rows and column values

    This hasn't worked for me Special K, Johns solution seems to have worked

+ 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. Replies: 2
    Last Post: 08-15-2015, 02:30 PM
  2. Replies: 3
    Last Post: 01-03-2014, 08:03 PM
  3. Combining Rows Based On Matching Values in one column
    By jeffocasm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-15-2013, 07:16 PM
  4. Deleting Rows based on matching values in column A, in two different worksheets
    By Insert Name in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 01-11-2013, 08:39 PM
  5. Matching values of one column with another rows
    By bimal1stus in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-27-2012, 09:50 AM
  6. Excel 2007 : Can Countifs be used to count values in rows
    By Taste2Bad in forum Excel General
    Replies: 2
    Last Post: 01-31-2011, 04:06 PM
  7. Match values and insert rows for non-matching values
    By Portmanteau in forum Excel General
    Replies: 1
    Last Post: 04-28-2009, 02:08 PM

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