+ Reply to Thread
Results 1 to 10 of 10

CountIf Question

  1. #1
    Registered User
    Join Date
    09-23-2003
    Location
    California
    Posts
    38

    CountIf Question

    I have a spread sheet to keep track of work schedules and I use a Capital letter to show a day 12 hour shift and a small letter to show a night 12 hour shift. I set up a countif formula to let me know if there were at least two of the same letters in the same day. That works okay but it counts them the same if they are both capitals or small letters. Would there be some way for the formula to count them only if there is both a small and capital letter and not if there are only small or capital letters?

    Jan
    1 2 3 4
    H H H h
    h h h h
    2 2 2 2 This is where the countif formula is and I would like it to not count unless there is both a capital and small letter not two of each.

    See attached sheet for a better sample
    Attached Files Attached Files
    Last edited by hodkd; 04-13-2009 at 06:45 PM. Reason: upload sample 2nd sample

  2. #2
    Registered User
    Join Date
    01-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    67

    Re: CountIf Question

    Try in A5:
    =IF(CODE(A3)<>CODE(A4),2,"")
    and copy across

  3. #3
    Registered User
    Join Date
    09-23-2003
    Location
    California
    Posts
    38

    Re: CountIf Question

    Thanks, this seems to work. Can this be used in the conditional format to change the color of the cell if it does equal 2?

  4. #4
    Registered User
    Join Date
    09-23-2003
    Location
    California
    Posts
    38

    Re: CountIf Question

    I used a conditional format to tell it to turn red if it equals 2 which works perfectly. Thanks

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: CountIf Question

    If that takes care of your need, be sure to EDIT your original post (Go Advanced) and mark the PREFIX box [SOLVED]
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  6. #6
    Registered User
    Join Date
    09-23-2003
    Location
    California
    Posts
    38

    Re: CountIf Question

    That works for the sample I attached but I need to send a larger sample for you to look at.

  7. #7
    Registered User
    Join Date
    01-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    67

    Re: CountIf Question

    Quote Originally Posted by hodkd View Post
    That works for the sample I attached but I need to send a larger sample for you to look at.
    So, I guess the solution didnt work for the larger sample...Post your larger sample then.

  8. #8
    Registered User
    Join Date
    09-23-2003
    Location
    California
    Posts
    38

    Re: CountIf Question

    I posted a larger sample in the orginal post.

  9. #9
    Registered User
    Join Date
    01-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    67

    Re: CountIf Question

    Try in B12:
    =IF(CODE(INDEX(B$3:B$10,MATCH(LEFT($A12,FIND("'",$A12)-1),B$3:B$10,0)))<>CODE(INDEX(B$3:B$10,MATCH(LEFT($A12,FIND("'",$A12)-1),B$3:B$10,0)+1)),2,"")

    copy down and across

    (and btw, C13 should be empty in your expected result)

  10. #10
    Registered User
    Join Date
    09-23-2003
    Location
    California
    Posts
    38

    Re: CountIf Question

    Sorry I was on vacation and didn't get back to the post till today. I put in the formula you suggested and it seems to work on some colums and not others. See attachment of actual spreadsheet. Any suggestions?
    Attached Files Attached Files

+ 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