+ Reply to Thread
Results 1 to 7 of 7

count based based on 2 columns

  1. #1
    Registered User
    Join Date
    01-31-2017
    Location
    IRELAND
    MS-Off Ver
    excel 2010
    Posts
    27

    count based based on 2 columns

    I have 3 columns
    column a is a horse race id
    column 2 is a horse name from that race
    column 3 is a P or N
    I have used 2 horses from the first race and 2 from the second and stripped out all the other columns.

    what I need is shown ..I need a formula to count the number of N and P
    each horse in each race shown in col d and col e

    it must be able to drag down for thousands of rows

    thanks very much

    race_no horse PN
    20150219CHELM_6:40 Ada Lovelace P
    20150219CHELM_6:40 Ada Lovelace N
    20150219CHELM_6:40 Ada Lovelace P
    20150219CHELM_6:40 Ada Lovelace N
    20150219CHELM_6:40 Ada Lovelace N
    20150219CHELM_6:40 Olney Lass N
    20150219CHELM_6:40 Olney Lass N
    20150219CHELM_6:40 Olney Lass P
    20150219CHELM_6:40 Olney Lass P
    20150219CHELM_7:10 Caledonia Laird P
    20150219CHELM_7:10 Caledonia Laird N
    20150219CHELM_7:10 Welsh Gem N
    20150219CHELM_7:10 Welsh Gem N

    race_no horse PN PCOUNT NCOUNT
    20150219CHELM_6:40 Ada Lovelace P 2 3
    20150219CHELM_6:40 Ada Lovelace N 2 3
    20150219CHELM_6:40 Ada Lovelace P 2 3
    20150219CHELM_6:40 Ada Lovelace N 2 3
    20150219CHELM_6:40 Ada Lovelace N 2 3
    20150219CHELM_6:40 Olney Lass N 2 2
    20150219CHELM_6:40 Olney Lass N 2 2
    20150219CHELM_6:40 Olney Lass P 2 2
    20150219CHELM_6:40 Olney Lass P 2 2
    20150219CHELM_7:10 Caledonia Laird P 1 1
    20150219CHELM_7:10 Caledonia Laird N 1 1
    20150219CHELM_7:10 Welsh Gem N 0 2
    20150219CHELM_7:10 Welsh Gem N 0 2
    Attached Files Attached Files
    Last edited by chester12; 08-23-2017 at 02:21 AM.

  2. #2
    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: count based based on 2 columns

    To best describe or illustrate your problem you would be better off attaching a dummy workbook. The workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    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

  3. #3
    Registered User
    Join Date
    01-31-2017
    Location
    IRELAND
    MS-Off Ver
    excel 2010
    Posts
    27

    Re: count based based on 2 columns

    thanks

    i have now attached the sample sheet

  4. #4
    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: count based based on 2 columns

    Thanks for the file

    why would you want to repeat the same entry, with the same count, multiple times? Wouldnt it make more sense to just show unique entries, with a count for that 1?

  5. #5
    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: count based based on 2 columns

    The formulas to give what you showed would be
    =COUNTIFS($A$2:$A$14,A17,$B$2:$B$14,B17,$C$2:$C$14,"p")
    =COUNTIFS($A$2:$A$14,A17,$B$2:$B$14,B17,$C$2:$C$14,"n")

  6. #6
    Registered User
    Join Date
    01-31-2017
    Location
    IRELAND
    MS-Off Ver
    excel 2010
    Posts
    27

    Re: count based based on 2 columns

    Thanks Fdibbins..works fine..cheers

  7. #7
    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: count based based on 2 columns

    Happy to help

+ 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. Sum across columns based on column headers or count of columns
    By RandiLee in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-08-2016, 09:59 AM
  2. Count Unique Values based on two columns
    By mpower1750 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-16-2016, 09:54 PM
  3. [SOLVED] Count based on difference of two columns
    By loafofbrett in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-08-2014, 03:49 PM
  4. [SOLVED] Count unique entries based on two columns
    By gradient in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-25-2013, 01:51 PM
  5. Count two columns based on different criteria for each
    By king12yan in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-29-2010, 03:16 PM
  6. Count based on rows and columns
    By statenja in forum Excel General
    Replies: 4
    Last Post: 06-23-2009, 04:57 PM
  7. formula to get the count based on criterial in two or more columns
    By sunilbm in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-03-2007, 01:13 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