+ Reply to Thread
Results 1 to 8 of 8

How to compare values in a table in one sheet to values in another sheet +++

  1. #1
    Registered User
    Join Date
    12-15-2015
    Location
    Gjerdrum, Norway
    MS-Off Ver
    2013
    Posts
    6

    How to compare values in a table in one sheet to values in another sheet +++

    Hi.

    First a little background information. I'm working as a mechanical engineer in the R&D department. We're currently working on converting a lot of old files in one system to another system (Inventor to SolidWorks). To keep track of how far we've come, we use an excel tracking sheet, where all the partnumbers to be converted are listed and "stamped" as approved or in progress or just blank.

    In another excel sheet, we've got the "break down" of the different assemblies/complete products.

    What I would like to make Excel do for me, is to pick the first value of the table in the "break down sheet" and search the tracking sheet to see if it's there.
    If it's NOT there, the cell/value should be marked red. If the value's there, I'd like excel to check the status. If it's been approved, the cell/value in the "break down sheet" should
    be colored green and yellow/orange if it's in progress or just blank. Then it should continue with the next value and so on, until all the cells in the table has been compared to the
    tracking sheet. Some of the cells in the table may also just be blank.

    Is there an easy way to do this, either with formulas in excel, or by writing a macro or anything? I'm really not an expert on neither excel nor macros/VBA, but maybe someone
    in here is up for a challenge? The formula/macro should be re-usable for different "break down sheets" and sizes of tables, so you should somehow be able to put in the "area"
    where the table is.

    Best regards

    Stig M. Thu

  2. #2
    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,937

    Re: How to compare values in a table in one sheet to values in another sheet +++

    Do you have a sample sheet that we can work with?
    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.

  3. #3
    Registered User
    Join Date
    12-15-2015
    Location
    Gjerdrum, Norway
    MS-Off Ver
    2013
    Posts
    6

    Re: How to compare values in a table in one sheet to values in another sheet +++

    Ahh, I forgot about the sample sheets. Please find the tracking sheet example and the break down sheet example here: https://www.dropbox.com/sh/x7l3t97tj...qMU8Tbwla?dl=0

    I also have an update to the coloring of the cells. If the number from the break down sheet exists in the tracking sheet, the cell/value in the break down sheet should be colored green if the status is approved.
    If the value exist, but has any other status than approved, it should be colored yellow/orange. If the value does not exist, the cell should be colored red.

    Best regards

    Stig M. Thu

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,570

    Re: How to compare values in a table in one sheet to values in another sheet +++

    Assuming that you are talking about matching the "Top Level Assembly Number" from the tracking sheet to the "Level 1, Item number" from the breakdown sheet, I have a question: The number 4822005 shows up twelve times in the tracking sheet and has both the status "approved" and "delivered". Should that number be colored green or yellow? I do have a solution for the first requirement, those numbers that appear on the breakdown sheet and do not appear on the tracking sheet. It is a conditional formatting rule: =AND(A3<>"",COUNTIFS(Tracking!$B$4:$B$275,A3)=0) applied to =$A$3:$A$252. I am attaching a file that shows your two sheets, in a workbook, with the rule applied. Once we get an answer to my question above, we can start working on the rules that will color the other Level 1 item numbers.
    CF to compare values in two sheets..xlsx
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Registered User
    Join Date
    12-15-2015
    Location
    Gjerdrum, Norway
    MS-Off Ver
    2013
    Posts
    6

    Re: How to compare values in a table in one sheet to values in another sheet +++

    Hi.
    Sorry for not giving a clear description of what I meant. The tracking sheet contains a list of parts (Part numbers column) and the corresponding Assembly/assemblies in which it is located. One Assembly may consist of a number of parts and sub assemblies, which in turn consist of parts and New sub assemblies and so forth, hence the multiple Levels in the break Down sheet (it may be thought of as a file within a folder within a folder...).

    So, what the formula/macro should be doing, is to look in the tracking sheet for a number that matches the values in the break Down sheet. One part or Assembly may occur multiple times. Take a screw or a nut i.e. It will typically be part of many assemblies and sub assemblies.

    The job for the formula/macro will be to identify the parts and assemblies that have been approved and which of the ones that haven't yet been approved and which ones are missing. The missing ones will then have to be located and added to the tracking sheet as they're being converted.

    So, I Guess there's some kind of hierarchy involved here as well. If a part/Assembly is found and is "in progress" it should be marked yellow, if it occurs another Place and has been approved, this should override the yellow marking, so that when a part has been marked green/approved, it should not get a yellow color if it's found in a "in progress"-state somewhere else in the tracking sheet.

    Best regards

    Stig M. Thu

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,570

    Re: How to compare values in a table in one sheet to values in another sheet +++

    OK, wow this took a while. This solution uses helper columns that can be hidden for aesthetics, or left un-hidden for evaluation. The helper columns, breakdown!F:K, show the status of the item number each time that it is given on the tracking sheet using the array formula
    Please Login or Register  to view this content.
    . Note: array formulas must be activated by pressing Ctrl+Shift+Enter (not just Enter). There are six columns because that is the maximum number of times that an item number appeared on the tracking sheet. The first rule simply finds item numbers on the breakdown sheet that are not listed on the tracking sheet and fills them red. the second rule will look at the helper column and if any of the status entries are "Approved" it will fill those cells green since any "Approved" overrules all other statuses. The final rule fills any item numbers that were also found on the tracking sheet yellow, assuming that they did not have any "Approved" statuses on the tracking sheet (which is born out by looking at the helper columns). Here is the file with the conditional formatting rules applied.
    CF to compare values in two sheets..xlsx
    Let me know if you have any questions.

  7. #7
    Registered User
    Join Date
    12-15-2015
    Location
    Gjerdrum, Norway
    MS-Off Ver
    2013
    Posts
    6

    Re: How to compare values in a table in one sheet to values in another sheet +++

    WOW.
    Thank you. I must say I just realized that this is propbably way out of my league when it comes to Excel, so I guess
    I'll just have to sit down and study your solutions in order to MAYBE be able to learn how you did it, so that I - if I'm
    lucky, will be able to reproduce something similar when it comes to the rest of the products.

    Just one final question.
    Let's say I have X number of assembly levels (Level 1, Level 2, Level 3 and so on).
    Is it possible to have Excel do the stuff you were able to make it do for more than one
    column. (Look through all "X" columns and have them marked according to the already listed rules?)

    Thanks again for all the time and effort you have put into this.

    Best regards

    Stig M. Thu

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,570

    Re: How to compare values in a table in one sheet to values in another sheet +++

    In some cases you could use the existing rules, in others you may need to make a new rule. To get the rule for red to work, in the attached file, for level 1 I simply extended the "Applies to:" for the rule to cover the items in column A (,$A$3:$A$257). Whereas the rule for green I wrote a new one (may have been able to modify the old one also) written specifically for that column. As you can see there can be multiple rules that produce the same fill color. There are some good tutorials for "Conditional Formatting" out there on the web, and just playing around with it is a good way to learn also. As to this query: You're welcome for the solution and thank you for the feedback and added reputation. Please take a moment to mark this thread 'Solved' using the thread tools link above your first post. Hope that you have a good day.
    CF to compare values in two sheets..xlsx

+ 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: 6
    Last Post: 07-26-2015, 03:43 AM
  2. compare sheet 1 with sheet 2 and copy unique values in sheet 1
    By irfanparbatani in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2014, 07:38 PM
  3. [SOLVED] Compare values between sheet and copy values
    By szpt9m in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-07-2014, 11:57 AM
  4. Find and compare values in a sheet.
    By JonesyCC in forum Excel General
    Replies: 2
    Last Post: 08-29-2013, 09:17 PM
  5. Copy from sheet 1 to next free in sheet 2 (compare values)
    By gangel in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-10-2012, 01:36 AM
  6. Compare values on sheet 1 to values on sheet2
    By Colin in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-02-2006, 02:25 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