+ Reply to Thread
Results 1 to 3 of 3

Countifs and multiple columns counting occurrence of any text problems

  1. #1
    Registered User
    Join Date
    02-16-2010
    Location
    Princeton, WV
    MS-Off Ver
    Excel 2003
    Posts
    6

    Countifs and multiple columns counting occurrence of any text problems

    I have been able to accomplish everything I want with excel up until now. This is the last function I need. After 4-5 hours unsuccessfully struggling with various ways to set this up, I’m turning to this community for help.

    Range 1: Column 1 named “Date”
    Criteria 1: Specific dates

    Range 2: Column 2 named “Batter”
    Criteria 2: specific batters

    Range 3: Column 3 named “First_runner”
    Criteria: Any text

    Range 4: Coumn 4 named “Second_runner”
    Criteria: Any text

    Range 5: Column 5 named “Third_runner”
    Criteria: Any text

    What I am trying to find is the number of at bats given specific dates and specific batters with any runners on base. The problem is that the Countifs function counts the text in columns 3, 4, and 5 multiple times.

    Example:

    =COUNTIFS(Date,G4,batter,H4,first_runner,"?*")+COUNTIFS(Date,G4,batter,H4,second_runner,"?*")+COUNTIFS(Date,G4,batter,H4,third_runner,"?*")

    The above function returns a count of “5.” I need for it to return a count of “3” because “posaj001” batted a total of 4 times on the criteria date, but he only batted with men on base a total of 3 times.

    This formula also needs to scale. I have tried a gazillion different methods for subtracting certain criteria, but I can never get it to come out right for every single situation.

    Is there an easy way to count how many times any text appears in any order in any of the runner columns using the date and batter criteria also? I suppose I could combine/concentate columns 3, 4, 5, but that is far from ideal.

    See attachment for details relating to the references above…
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    02-16-2010
    Location
    Princeton, WV
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Countifs and multiple columns counting occurrence of any text problems

    nevermind.... i figured it out! (finally...) instead of counting the rows with text, i counted the rows that were blank and then subtracted them from the amount of at bats.

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Countifs and multiple columns counting occurrence of any text problems

    Thanks for posting back with your work around.

    FWIW it might be easier to simply store "bases" in F, eg:

    F2: =COUNTIF($D2:$F2,"?*")
    copied down

    Then use that in a single COUNTIFS

    =COUNTIFS(date,$G$4,batter,$H$4,bases,">0")

    where bases is new named range
    (in your sample the named ranges did not encompass all data points but I'm guessing it's just a simplified ex.)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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