+ Reply to Thread
Results 1 to 29 of 29

Matching Data

  1. #1
    Forum Contributor
    Join Date
    05-03-2020
    Location
    London
    MS-Off Ver
    MICROSOFT 365
    Posts
    282

    Matching Data

    I have an list of names (sheet 2) that should be in the Sheet 1 Column B.

    I want to create a way so I know which names from sheet 1 need to be removed and which names need to be added.

    Any help will be well appreciated
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Matching Data

    You can get your desired end result simply by copying the sheet2 list of names to sheet1, but I'm guessing you want to see explicitly who is added and who is deleted.

    Note that you state in Sheet1!B1 that names should be copied exactly as on [Sheet2] yet you have "Bains Raj" on Sheet1 and "Raj Bains" on sheet 2. I corrected that.

    On Sheet1!C2 I added:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    This column contains "REMOVE" as appropriate.
    Note: I shortened the title in your table to "Claimant" so that the formula doesn't look quite as horrendous.

    On Sheet2!B2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    This column contains "ADD" as appropriate.

    A modified version of your workbook implementing the above is attached.

    Hope this helps. Let us know.
    Attached Files Attached Files
    Geoff

    Did I help significantly? If you wish, click on * Add Reputation to say thanks.
    If your problem has been resolved please select ?Solved? from the Thread Tools menu

  3. #3
    Forum Contributor
    Join Date
    05-03-2020
    Location
    London
    MS-Off Ver
    MICROSOFT 365
    Posts
    282

    Re: Matching Data

    hi thank you very much for the help. however i would like results to show in separate tables like shown in sheet 1 - NAMES TO BE REMOVED and NAMES TO BE ADDED with the actual names

  4. #4
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Matching Data

    I have a solution for you. I think that a "misspelling" mentioned above was actually on purpose, as you probably want to capture the name whether the surname or the first name is on the list. I did not include the naming solution, but made it so that you achieve your requested results. Let me know if you have questions.
    Please Login or Register  to view this content.
    The file is too large to upload. I will try to shrink and upload asap.
    Attached Files Attached Files
    Last edited by maniacb; 06-27-2020 at 09:23 PM. Reason: Corrections to response

  5. #5
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Matching Data

    Apologies for the misunderstanding. Attached is a revised workbook that I think now does what you want.

    You now have a choice of a VBA based solution from maniacb or this formula based solution. Hopefully at least one of them work for you.

    @maniacb: As cell B1 on the OP's workbook says "CLAIMANT NAME
    (copy the name exactly as on the build)" I assumed that "Bains Raj" would not be considered to be equivalent to "Raj Bains". Let's see what the OP says!

    In the attached workbook:
    Columns H is a "helper" column for the "names to be removed". It lists the required names but potentially with blanks in between. In H2 copied down to H20 or in your final application copy as far as the length of your list in Sheet1!B:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Names to be removed are calculated in column-D. The formula simply removes any blanks present in column-H. In D2 copied down to D20:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Change "20" in this formula as required.

    "Names to be added" are calculated in column-F with the assistance of helper column-I. The formulas are similar to the "names to be removed" formulas.

    The attached workbook implements the above.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    05-03-2020
    Location
    London
    MS-Off Ver
    MICROSOFT 365
    Posts
    282

    Re: Matching Data

    hi GeoffW283 and GeoffW283, thank you very much for the solutions. i prefer the formula based solution. i have face slight issue with he formula. it there is a extra space then this causes errors
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Matching Data

    Thanks for the feedback!

    First, something you have done has corrupted the formulas in the following cells: D4, F4, D8, F8. What alerted me was the little green triangle in the top left corner of these cells that indicates a possible anomalous formula. I fixed this by selecting D2:F2 and copy/paste-formula down to row 20. That explains why MIKE JOHN did not appear in the "Names to be added list" which I believe was a problem. I have fixed this in the attached mod to your workbook. In general there should be no need for you to change anything in any of columns D thru J.

    Now onto your problem. You say that an extra space at the end of "JOHN" in cell sheet1!B8 "causes errors". At present as there is no "JOHN " on sheet2 then "JOHN " has been placed on the "Names to be removed" list which seemed logical. Do you want me to ignore space characters at the end of names in sheet1-col-B? How about spaces at the end of names on sheet2-col-A?

    Let me know.

    Thanks

    Geoff
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    05-03-2020
    Location
    London
    MS-Off Ver
    MICROSOFT 365
    Posts
    282

    Re: Matching Data

    thank you very much for fixing the formula. Spaces can be in both sheets (both list of names), it all depends no how people type and when coping the information for our database can can cause spaces.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Matching Data

    Why not mitigate the problem? Create a data validation list of names for them to choose from.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  10. #10
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Matching Data

    Quote Originally Posted by DEEARO View Post
    Spaces can be in both sheets (both list of names), it all depends no how people type and when coping the information for our database can can cause spaces.
    If Ali's suggested approach is possible then go with that.

    If that's not possible then you could use the trim() function to clean up your source data. This function removes leading and trailing spaces.

    If neither of the above is possible then I have modified the helper column formulas to make copious use of the trim() function. This is the least desirable approach as it adds complexity and in addition now both helper column formulas need to be entered as array formulas.
    H2 copied down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    J2 copied down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Bothe of these formulas need to be entered as array formulas with CTRL-SHIFT-ENTER.

    The attached workbook implements these changes.

    Let us know which, if any, of these approaches works for you.
    Attached Files Attached Files
    Last edited by GeoffW283; 06-30-2020 at 04:42 PM.

  11. #11
    Forum Contributor
    Join Date
    05-03-2020
    Location
    London
    MS-Off Ver
    MICROSOFT 365
    Posts
    282

    Re: Matching Data

    thank you very much GeoffW283 that is prefect for what I wanted. I have small problem I cannot solve. I have changed the layout and now I am getting an error (FALSE)message (SEE sheet named RESULTS) and not sure how to resolve it.
    Attached Files Attached Files
    Last edited by DEEARO; 07-02-2020 at 06:38 AM.

  12. #12
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Matching Data

    Somehow during your layout change some of the formulas got scrambled. I have fixed this in the attached revision (revA) of your file. I have also copied the formulas down to row 1000 which I think is part of what you were trying to do. I tested these changes against your caseload3.xlsx data as well as the data in your prior workbook and I believe both give the expected results.

    Let me know if this works for you.

    Geoff
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    05-03-2020
    Location
    London
    MS-Off Ver
    MICROSOFT 365
    Posts
    282

    Re: Matching Data

    Thank you very much , amazing

  14. #14
    Forum Contributor
    Join Date
    05-03-2020
    Location
    London
    MS-Off Ver
    MICROSOFT 365
    Posts
    282

    Re: Matching Data

    sorry again I have future issues.

    whilst copy and pasting the data from the actual source I get data which is not required. I can filter the data however this not reflecting well with the results as rows go missing and filter information still appearing. Not sure what is the best solution, I was thinking maybe having the data on the another tab and copy and pasting the information over but is there an easier way?
    Attached Files Attached Files

  15. #15
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Matching Data

    First an observation (and I also saw this on a previous iteration of your workbook): The formulas in C2:I2 are not being copied down to subsequent rows correctly. One example: in cell C3 towards the end of the formula there is a reference to ROW(A2), but in the next row, cell C4 references ROW(A4) - it should be ROW(A3). There's a number of similar problems. I'm not sure what you are doing to cause this but it is easily repaired: First, clear all filters then select C2:I2 and copy down as many rows as you need.

    That doesn't solve your issue which I think is that you don't want to see "intensive" or "intensive supporting" (and maybe others) appearing in the "names to be removed column. One thought - would it be possible to filter out these values right at the data source - before they are imported to Excel? Are there other entries to be filtered, if so how do I distinguish then from real names?

    While you contemplate the above, let me think if there's anything I can do formula-wise.

  16. #16
    Forum Contributor
    Join Date
    05-03-2020
    Location
    London
    MS-Off Ver
    MICROSOFT 365
    Posts
    282

    Re: Matching Data

    Thank you very for noticing the problem in the rows which I know have fixed.



    When coping the information for our internal website (I have tired power query - to get data directly but the site blocks it - it is password protected and we not given the password - it automatically signs us in)

    I filter the data first on the site but when I copy and paste the data in excel it still comes with information not required (mainly intensive and intensive support).

    At the moment I copying the information into another tab ("filter"), filtering the data and then coping and pasting it result tab. Maybe there could be formula which automatically gets the filtered information from "filter tab" Or maybe you have another solution.
    Attached Files Attached Files

  17. #17
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Matching Data

    Quote Originally Posted by DEEARO View Post
    Maybe there could be formula which automatically gets the filtered information from "filter tab".
    I'll go with your idea. On the RESULTS worksheet enter the following formula in cell A2 and copy down as far as is needed:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Note that this is an array formula and needs to be entered via CTRL-SHIFT-ENTER.

    The formula filters out "intensive" and "intensive supporting". It could readily be extended to add a few more items, but too many would get unwieldy.

    I have attached an update to your workbook with the above change made.

    Hopefully this helps. Let us know how you get on with it.
    Attached Files Attached Files

  18. #18
    Forum Contributor
    Join Date
    05-03-2020
    Location
    London
    MS-Off Ver
    MICROSOFT 365
    Posts
    282

    Re: Matching Data

    Hey GeoffW283 thank you very much. It works but I found one further issue, I am getting blank rows in my results. I believe this is because I get blanks when I copy and paste the information for the original source

  19. #19
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Matching Data

    OK, here's a small change to the formula to filter out entirely blank lines. But first check whether the Filter tab lines are entirely blank or whether there's a "space" character as well. If the latter then change filter!$A$2:$A$15="" to filter!$A$2:$A$15=" ". If there's a varying number space characters then let me know.

    I've also reformatted the formula to hopefully make it a bit more obvious how to modify the formula to filter out additional unneeded rows if required.

    On the RESULTS worksheet enter the following formula in cell A2 and copy down as far as is needed:

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


    This is still an array formula and needs to be entered via CTRL-SHIFT-ENTER.

    Let me know if this works for you.

    Geoff

  20. #20
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Matching Data

    Deearo, I went ahead and completed the VBA solution to your original request. Geoff formulas are impressive and I am learning a lot from them. Here is the VBA solution for you.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  21. #21
    Forum Contributor
    Join Date
    05-03-2020
    Location
    London
    MS-Off Ver
    MICROSOFT 365
    Posts
    282

    Re: Matching Data

    Geoff thank you so much for the help and it has helped me a lot.

  22. #22
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Matching Data

    No problem. Glad to help. Thanks for the feedback

  23. #23
    Forum Contributor
    Join Date
    05-03-2020
    Location
    London
    MS-Off Ver
    MICROSOFT 365
    Posts
    282

    Re: Matching Data

    I have noticed I am getting a slight issue with the formula. In the CASELOAD sheet if I delete a row, then I get error messages in the Filter sheet column G. Any solution will be appreciated
    Attached Files Attached Files

  24. #24
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Matching Data

    I think you mean that the error message, #REF, appears in the Results worksheet, not the Filter worksheet right?
    The reason is that if you delete a line from the CASELOAD then the formula on the corresponding row in RESULTS is trying to reference a row that no longer exists.

    The easiest approach would be to use "clear contents" from a row rather than deleting the row. Will this work for you?

    Alternatively to fix the #REF errors after you have deleted rows - once are done with deleting rows in CASELOAD then select G2 and copy the formula down all the way.

    It neither of these approaches works for you then let me know - there may be a formula based solution that avoids the #REF errors, although there will likely be a performance penalty.

  25. #25
    Forum Contributor
    Join Date
    05-03-2020
    Location
    London
    MS-Off Ver
    MICROSOFT 365
    Posts
    282

    Re: Matching Data

    I understand thank you .


    is there a way I can copy the sheet into another file without the formatting of the formula changing (when I copy the page into another excel sheet it, it still stays linked to the original file). I need to add filter and result sheets into another 85 workbooks for different staff can have a copy. What is the easiest way, each workbook already as caseload sheet)

  26. #26
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Matching Data

    Can it work the other way around? - Like this:
    1. In master_caseload.xlsx on the CASSELOAD worksheet select A2:A100 (or down to wherever your data ends
    2. Right-click > Clear contents
    3. In the first of your 85 workbooks - I'll call it Workbook_01 - on it's CASELOAD worksheet, select A2:A100 (or down to wherever your data ends)
    4. Paste to the CASSELOAD worksheet in the master_caseload workbook
    5. Save as workbook_01.xlsx
    6. Re-open master_caseload.xlsx then repeat the above steps for each of your 85 workbooks


    Is this a one-off exercise or something that you need to repeat regularly?

    If the latter then you probably want to think about automating this. That would be a separate problem though!

    Hopefully I have understood the problem. Let me know if the above works for you.
    Last edited by GeoffW283; 07-31-2020 at 08:10 PM.

  27. #27
    Forum Contributor
    Join Date
    05-03-2020
    Location
    London
    MS-Off Ver
    MICROSOFT 365
    Posts
    282

    Re: Matching Data

    Thank you for the solution, it is one time task. I was just hoping there was a quicker solution then copying and pasting.

    I will like to go one step further to original solution: is there way to automate the names that need to be added and removed from the caseload sheet.?

    your help will be apricated
    Attached Files Attached Files

  28. #28
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Matching Data

    I'm not sure why you attached the file? (a) it seems to have removed the filter formulas from results!A:A and (b) results!A1 contains DEEPAK rather than a header like "Name". This results in DEEPAK erroneously appearing in results!E2 (names to be added).

    "I was just hoping there was a quicker solution then copying and pasting."
    In addition it may be a concern for you that if the formulas need tweaking in any way you would now have to manually make the change in 85 different places.

    I think this would have to be a VBA solution that might be feasible if it was possible to collect all 85 workbooks together in one folder. If they are scattered across numerous user accounts then I don't know how this would work. A robust VBA solution would be stretching my VBA skills. If you want to pursue this then maybe maniacb who provided a VBA solution in post #21 might have ideas about how this might work. Alternatively you might want to open up a new thread for this specific problem in the VBA section of this forum - there are many people there with vastly better VBA skills than me!

    "I will like to go one step further to original solution: is there way to automate the names that need to be added and removed from the caseload sheet?"
    If I correctly understand what you mean then I have added Results!B:B that implements the adds and removes. Let me know if I have this right.

    See the attached workbook.

    Geoff
    Attached Files Attached Files

  29. #29
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Matching Data

    I am trying to visualize how it is you have 85 files and want to automate the process. We can create code that is run from your personal.xls file that can be run for each file, or run an automation on a file directory that contains all said files, as per GEOFF's recommendation. Although I have been following along, can you provide me a recap of what you may want automated, if you still want to pursue this option?

+ 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. Replies: 1
    Last Post: 03-27-2019, 11:57 PM
  2. [SOLVED] Matching and removing matching data, and data filter with VBA (Excel 2003)
    By Ditch1983 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-18-2017, 04:41 PM
  3. Finding Matching Data in one Column/Adding corresponding matching string value.
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-02-2013, 07:23 PM
  4. Indexing and matching data from date range and matching
    By Rickomicko in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-19-2013, 11:46 AM
  5. Matching Data between Files , Deleting Matching Rows
    By nem_vdoxx in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-20-2013, 11:00 AM
  6. Replies: 2
    Last Post: 04-18-2013, 05:56 PM
  7. SQL Query to get count of matching & non-matching data from two tables
    By Kiran2012 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-13-2013, 10:32 PM

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