+ Reply to Thread
Results 1 to 6 of 6

compare two cells with OR function

Hybrid View

  1. #1
    Registered User
    Join Date
    07-30-2012
    Location
    Arlington, TX
    MS-Off Ver
    Excel 2010
    Posts
    47

    compare two cells with OR function

    I have a speadsheet of 3,000 rows. I attached a sample.

    I am trying to count the number of rows that have any combination of the following

    Some High School for both columns
    High School Graduate for Both Columns
    a combination of the two above.

    compare two cells.xlsx

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: compare two cells with OR function

    In A2 use

    =--(COUNTIF(A2:B2,"*High school*")>0)

    Copy down
    Last edited by Ace_XL; 12-10-2012 at 04:30 PM.
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Registered User
    Join Date
    07-30-2012
    Location
    Arlington, TX
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: compare two cells with OR function

    Can you talk me through what the formula means? Why the two -- before and why the >0 after?

  4. #4
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: compare two cells with OR function

    Quote Originally Posted by ghladik View Post
    Can you talk me through what the formula means? Why the two -- before and why the >0 after?
    The >0 returns TRUE in case of any matches with high school and wild characters *. The -- converts TRUE to 1 and FALSE to 0

  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: compare two cells with OR function

    this gives a total of 6...

    =COUNTIFS(A2:A27,"*High school*",B2:B27,"*High school*")

    edit: Ace, fromthe looks of it, your formula gives a 1 for if "either" parent have *High school*. I think the OP wanted "both Father and Mother have eitehr a "High School Degree" or "Some High School"
    Last edited by FDibbins; 12-10-2012 at 04:50 PM.
    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

  6. #6
    Registered User
    Join Date
    07-30-2012
    Location
    Arlington, TX
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: compare two cells with OR function

    Perfect- Thanks

+ 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