+ Reply to Thread
Results 1 to 6 of 6

count exact matches across a range

  1. #1
    Registered User
    Join Date
    08-17-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    38

    count exact matches across a range

    I have a spreadsheet where I have used a conditional formatting formula to highlight all the exact matches between multiple records and their individual values (rows across the spreadsheet) and a single record at the top. Every time there's an exact match, I highlight the cells a color. I would like to count all the cells that have a color (or use another function) to count all the exact matches between each of the individual items and their counterparts in the record at the top. There are hundreds of individual individual values/items to compare. Here's an example:

    ITEM 1 ITEM 2 ITEM 3

    RECORD TO COMPARE - STANDARD A 10 X
    RECORD 1 A 15
    RECORD 2 B 10
    RECORD 3 A X

    Based on this, the count for RECORD 1 would be 1, the count for RECORD 2 would also be 1 and the count for RECORD 3 would be 2 based on the number of individual matches.

    I could copy all the conditional formatting as regular formatting and then replace all with a unique value and get a count that way. Anything easier?

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: count exact matches across a range

    (How to) Upload a Workbook directly to the Forum
    (please do not post pictures or links to worksheets)
    • Click Advanced next to Quick Post button at the bottom right of the editor box.
    • Scroll down until you see "Manage Attachments",
    • Click the "Choose" button at the upper left (upload from your computer).
    • Select your file, click "open", click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Close the Attachment Manager window.
    • Click "Submit Reply"
    Note: Please do not attach password protected workbooks/worksheets
    Ensure to disable any Workbook Open/Autorun macros before attaching!
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    08-17-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: count exact matches across a range

    thanks Ben. I know how to attach documents. I'm just curious if there's even a formulaic approach at all. I thought my example in the post was fairly straightforward, no? Probably easiest for me to convert all colored cells to static with a macro and then convert those to a unique value and count that value.

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: count exact matches across a range

    What formula or criteria are you using for the conditional formatting? If you are using a formula, it seems like it should be a very similar formula -- maybe in a COUNTIF() or COUNTIFS() function.

    Based on the three records you posted and the results you suggest, something as simple as (assuming record 1 is in row 4) =COUNTIFS(B$4:B4,B4) would count how many times the "A" in B4 occurs in the range between B4 and Bcurrentrow (note how I used a mix of relative and absolute referencing to specify that kind of running count).

    Is that the kind of thing you are looking for?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Registered User
    Join Date
    08-17-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: count exact matches across a range

    Thanks MrShorty. The values are all different though. What I would do if there were not 900 different columns evaluating exact matches using a formula within conditional foramatting is simply use COUNTIF or COUNTIFS because I would only be dealing with a handful of variables, but I actually need to evaluate if B4 = B1, H4 = H1, etc. all the way across the sheet and then count those that are true. Inserting individual columns for exact matches means I would insert hundreds of columns. I think perhaps converting the colors to static colors, replacing all of them with "unique value" and then counting those might be easiest. I would just transfer that back to my original sheet and then have counts...sounds kind of clunky, yet I know it would work.

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: count exact matches across a range

    Seattlites when you say
    to count all the exact matches
    then A<>a, x<>X ... etc. I've taken that literally. Is that the meaning you intend?

    I am not clear on exactly what you want to do on the conditional formatting part.

    For the counts part here are three formulas ... array entered ... that count all the exact matches. If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Formula: copy to clipboard
    Please Login or Register  to view this content.




    A
    B
    C
    D
    E
    F
    1
    A
    X
    10
    2
    RECORD 1
    A
    15
    1
    1
    1
    3
    RECORD 2
    B
    10
    1
    1
    1
    4
    RECORD 3
    A
    X
    2
    2
    2
    Last edited by FlameRetired; 08-29-2017 at 08:40 PM. Reason: Added formulas
    Dave

+ 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 exact text within a range
    By alexandra22 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-27-2017, 02:59 PM
  2. Replies: 4
    Last Post: 01-06-2015, 09:15 PM
  3. Replies: 2
    Last Post: 09-15-2014, 09:58 AM
  4. Replies: 4
    Last Post: 12-10-2013, 06:41 PM
  5. Replies: 0
    Last Post: 08-11-2012, 03:25 PM
  6. Count exact matches in range
    By JuJuBe in forum Excel General
    Replies: 1
    Last Post: 03-09-2010, 08:13 PM
  7. Replies: 1
    Last Post: 06-17-2006, 09:10 PM

Tags for this Thread

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