+ Reply to Thread
Results 1 to 5 of 5

compare data

  1. #1
    dr chuck
    Guest

    compare data


    I have a range of manually entered data (ie A2:c6). I want to compare the
    data in the a2:c6 range to data that was manually entered into (ie d2:f6).

    I want the spreadsheet to let me know in some manner if the data is the same
    or is not the same in these ranges. If it could tell me what cells dont match
    that would be good also.


    --
    dr chuck

  2. #2
    Tim Williams
    Guest

    Re: compare data

    '*****************************************
    dim c as range
    dim bMismatch as boolean

    bMismatch = false
    for each c in range("A2:C6")
    if c.value <> c.offset(0,3).value then
    c.interior.color=rgb(200,0,0)
    bMismatch = true
    end if
    c.interior.color=rgb(0,200,0)
    else
    next c

    if bMismatch then msgbox "Some values did not match"
    '******************************************
    Tim


    "dr chuck" <[email protected]> wrote in message news:[email protected]...
    >
    > I have a range of manually entered data (ie A2:c6). I want to compare the
    > data in the a2:c6 range to data that was manually entered into (ie d2:f6).
    >
    > I want the spreadsheet to let me know in some manner if the data is the same
    > or is not the same in these ranges. If it could tell me what cells dont match
    > that would be good also.
    >
    >
    > --
    > dr chuck




  3. #3
    Robert
    Guest

    Re: compare data

    Tim,
    I copied your code but had to delete "else" for it to work. All cells in
    A2:C6
    are bring coloured irrespective of data mismatch. Is this what is intended or
    only the mismatched cell(s) is(are) to be coloured.
    --
    Robert




  4. #4
    roundabout
    Guest

    Re: compare data


    Personally I'd do it with conditional formatting to highlight the
    differences between the 2 sets of data.

    Go in to cell D2, then choose Conditional Formatting from the Format
    Menu bar

    Under Condition 1 choose "Formula is" and then type

    =IF(A2<>D2,TRUE,FALSE) in to the box on the right.

    Click Format and choose how you want to highlight the differences (eg
    in red text).

    Then click Add >>

    This will compare cell D2 to cell A2 and if they are different then D2
    will show in a different format

    And if you Format Copy that cell to your other ranges it'll do the
    rest.

    Hope that makes sense?

    Lee



    --
    roundabout
    ------------------------------------------------------------------------
    Posted via http://www.mcse.ms
    ------------------------------------------------------------------------
    View this thread: http://www.mcse.ms/message2425323.html


  5. #5
    Robert
    Guest

    Re: compare data

    Thanks Lee, I prefer VBA for my application.
    --
    Robert




+ 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