+ Reply to Thread
Results 1 to 6 of 6

Macro to compare check-in vs. check-out data

  1. #1
    Registered User
    Join Date
    12-07-2015
    Location
    st louis
    MS-Off Ver
    2013
    Posts
    10

    Post Macro to compare check-in vs. check-out data

    Ok so i'm using an excel table to manage a deployment of some equipment, the person picking up equipment will have a badge with QR code (unique identifier) and the equipment will have the same. I currently have an excel workbook with 2 tabs one for picked up data and one for return data.

    I want to see if there is a way to run a macro to compare the 2 lists at the end of the day to ensure not only all equipment was returned but each person returned the equipment they originally picked up. Ideally i would like the data returned on a 3 tab that would highlight in green all those that are correct, highlight in yellow discrepancy, highlight in red data that exists on one sheet but not the other with a reference to which tab the original data is found on. I have attached a picture of what each tab looks like in my workbook.

    I know this could be done with a Vlookup and concatenation but i'm looking for a less manual option and not sure if this is even possible. Any help would be greatly appreciated.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by skylark332; 03-29-2016 at 12:19 PM.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Macro to compare check-in vs. check-out data

    My philosophy is to use Excel to do as much heavy lifting as possible and use VBA to stitch the pieces together.

    I did a couple of things with your tables. First, tables know how big they are. So you do not have to select all rows for the tables. The table will add a row each time data is entered into the next blank row. I also renamed the tables to Table_In and Table_Out and eliminated some blank spaces in the headers.

    I also saw your attempts to return the cursor to the first cell of the next row. I eliminated the old code that was trying to do that and coded change events on the input sheets to return the cursor to the first column next row whenever something in column B is changed.

    I did add helper columns to the tables. These are used in the code and the columns can be hidden. Tables also automatically add formulas each time a row is added.

    I made use of pivot tables to give me unique values for combined data. I overlaid these with named dynamic ranges so I could search them in the code.

    I can handle 4 cases:
    1. A good return - a person hands the same headset that was checked out.
    2. Missing return - the headset is not returned.
    3. Mismatched headset - a person checks out one headset, but returns a different one.
    4. Additional return - a person hands in a headset that was not checked out.

    The pivot data and pivot good - bad sheets can be hidden.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    12-07-2015
    Location
    st louis
    MS-Off Ver
    2013
    Posts
    10

    Re: Macro to compare check-in vs. check-out data

    Dflak thank for the help, in testing this out i'm getting false "mismatched returns" see the attached grid and yo will see that even though someone shows as good return they also are listed as mismatched return
    Attached Files Attached Files

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Macro to compare check-in vs. check-out data

    I figured out what happened. If a pivot table doesn't find what it is filtering for, it reverts to (All). In this case, we have no mismatches, so the filter on the table for False reverts to all. To compensate for this I do a count on true and false and store these on the Pivot Good Bad Sheet. Depending on the results I either skip the section or reset the filter and process the data.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    12-07-2015
    Location
    st louis
    MS-Off Ver
    2013
    Posts
    10

    Re: Macro to compare check-in vs. check-out data

    Dflak thanks again, this seems to be working perfectly. Really appreciate it!!

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Macro to compare check-in vs. check-out data

    It was a good drill for me too. That was a good catch on the pivot tables and I need to keep that kind of error trapping in mind when I code in the future.

+ 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. How to check if excel file is Checked Out in SharePoing Check Out, run code, Check In
    By jrtraylor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-08-2016, 04:36 PM
  2. Macro to compare two column return OK or Check.
    By coolhit in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-28-2013, 05:32 PM
  3. Automatically check one or more check boxes when a parent check box is manually checked
    By Steverizer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-28-2013, 01:56 PM
  4. Macro to check for blank cell entry, copy previous value, and check for duplicates
    By xPunxNotDeadx in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-26-2009, 06:33 PM
  5. Compare Data Script To check Names
    By realniceguy5000 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-02-2008, 11:37 AM
  6. Macro to Compare and check two rows
    By ultimatekhan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-08-2007, 10:13 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