+ Reply to Thread
Results 1 to 5 of 5

Count If Formula Help

  1. #1
    Forum Contributor
    Join Date
    11-23-2013
    Location
    San Diego
    MS-Off Ver
    Excel 2013
    Posts
    457

    Count If Formula Help

    I have a count if formula in my worksheet that produces a number rank for one column based on criteria from other columns in the worksheet. I'm running into a problem with the formula as it works great for all players with a current rank, but for players without a rank it's giving them a 1 instead of just leaving it blank.

    Example:

    I have a list of players, which all have an Overall Rank listed in column E. I have two additional columns (G and I) which break all the players into two separate leagues (AL/NL) based on what league they play in (Column D). The formula gives a rank to all players solely from the AL or NL based on the rank in Column E.

    For players without a rank in column E, their rank in column G and I should then also be blank. Cell I992, should be blank but for some reason it is giving that player a 1, same with the rest of the guys below him. Can anyone help with this? Also, does anyone know why it takes so long for excel to calculate all the formulas?

    My worksheet is attached, thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Count If Formula Help

    Your IF condition only states if D = G, do something and add 1. The 'something' is zero so the result is 1.

    Add another condition to your test and make them both be true.

    G4:

    =IF(AND($D4=G$2,E4<>""),COUNTIFS($D$4:$D$1010,$D4,$E$4:$E$1010,"<"&E4)+1,"")
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Forum Contributor
    Join Date
    11-23-2013
    Location
    San Diego
    MS-Off Ver
    Excel 2013
    Posts
    457

    Re: Count If Formula Help

    Quote Originally Posted by daffodil11 View Post
    Your IF condition only states if D = G, do something and add 1. The 'something' is zero so the result is 1.

    Add another condition to your test and make them both be true.

    G4:

    =IF(AND($D4=G$2,E4<>""),COUNTIFS($D$4:$D$1010,$D4,$E$4:$E$1010,"<"&E4)+1,"")
    I entered in your formula and it's still giving a 1 for cells G1002:G1010. Any ideas?

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Count If Formula Help

    I see. The cells are not blank, but contain a single space.

    =len(e1002) = 1

    =code(e1002) = 32

    ASCII code 32 = Space Key

    =IF(AND($D1002=G$2,E1002<>" "),COUNTIFS($D$4:$D$1010,$D1002,$E$4:$E$1010,"<"&E1002)+1,"")

    or

    =IF(AND($D1002=G$2,E1002<>char(32)),COUNTIFS($D$4:$D$1010,$D1002,$E$4:$E$1010,"<"&E1002)+1,"")
    Last edited by daffodil11; 12-26-2014 at 07:59 PM.

  5. #5
    Forum Contributor
    Join Date
    11-23-2013
    Location
    San Diego
    MS-Off Ver
    Excel 2013
    Posts
    457

    Re: Count If Formula Help

    Quote Originally Posted by daffodil11 View Post
    I see. The cells are not blank, but contain a single space.

    =len(e1002) = 1

    =code(e1002) = 32

    ASCII code 32 = Space Key

    =IF(AND($D1002=G$2,E1002<>" "),COUNTIFS($D$4:$D$1010,$D1002,$E$4:$E$1010,"<"&E1002)+1,"")

    or

    =IF(AND($D1002=G$2,E1002<>char(32)),COUNTIFS($D$4:$D$1010,$D1002,$E$4:$E$1010,"<"&E1002)+1,"")
    That worked! Thanks a bunch

+ 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. [SOLVED] Count formula not count hidden cells in table
    By tlacloche in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-06-2013, 02:35 PM
  2. [SOLVED] Count and average formula needed to not count text field
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-07-2013, 05:30 PM
  3. [SOLVED] Count/No Count for year entered---formula help
    By awest181 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-26-2012, 02:07 PM
  4. Replies: 5
    Last Post: 08-29-2012, 05:25 PM
  5. Count Formula-count the number of times
    By admiral7921 in forum Excel General
    Replies: 3
    Last Post: 01-07-2011, 09:07 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