+ Reply to Thread
Results 1 to 5 of 5

Compare columns in 2 sheets and then return a value in another column

  1. #1
    Forum Contributor
    Join Date
    07-25-2017
    Location
    UK
    MS-Off Ver
    Office 365 Excel Version 2202 Build 16
    Posts
    184

    Compare columns in 2 sheets and then return a value in another column

    Hi,

    I have attached my excel spreadsheet which I have been trying to develop. The problem I have is as follows:

    I have an old list or organizations. A system generates a new list of organizations however it does not produce the Owner column.

    I have an old list of organizations which I need to compare monthly to a new list of organizations to highlight differences and identify the owner in the new list organizations.

    Ignore the conditional formatting - I think I have found a formula to highlight the differences whereby a comparison is made and a value appears in the ACTION column.

    I need a formula which:

    1. Compares the org code in the new list to the org code in old list to check if they match.
    2. if the org codes in both sheets match, the OWNER column in the NEW sheet should be populated with the value from the OWNER column in the OLD sheet.
    3. if the org codes do not match no value should appear in the OWNER Column of the new sheet.

    Any help would be appreciated.
    Attached Files Attached Files

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

    Re: Compare columns in 2 sheets and then return a value in another column

    Try this code:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    07-25-2017
    Location
    UK
    MS-Off Ver
    Office 365 Excel Version 2202 Build 16
    Posts
    184

    Re: Compare columns in 2 sheets and then return a value in another column

    Hi,

    Thank you. I tried the code but I just get a msgbox that appears stating the number 4.

    Not sure if you have mis-understood my requirement. Sorry if comes across as confusing.

    I just need a formula that will check to see if the org codes match on both sheets and then populate the 'owner' column in the sheet NEW with whatever is populated in the owner column in sheet OLD. Thanks

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

    Re: Compare columns in 2 sheets and then return a value in another column

    Here is another attempt.
    Please Login or Register  to view this content.

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,940

    Re: Compare columns in 2 sheets and then return a value in another column

    An alternative solution is with Power Query/Get and Transform found on the Data Tab of the Ribbon. A simple case of joining the two tables and looking for matches and differences.

    MCode follows:
    Please Login or Register  to view this content.
    Review PQ
    In the attached file
    Click on any cell in the new table
    On the Data Tab, click on Queries & Connections
    In the right window, double click to open Query
    Review PQ steps

    M-code basics:
    - "let" is the start of a query
    - "in" is the closing of a query
    - each transformation step sits in between those 2 lines
    - each step line is ended by a comma, except the last one
    - "Source" is always the first step (Source Data)
    - After "in" you have the last step referenced

    Excel 2016 (Windows) 32 bit
    A
    B
    C
    D
    E
    F
    1
    Org Code Organisation Name Owner Org Code.1 Organisation Name.1 Custom
    2
    5
    Manchester John
    5
    Manchester Match
    3
    3
    Leeds John
    3
    Leeds Match
    4
    9
    Birmingham John
    9
    Birmingham Match
    5
    8
    London Tony
    8
    London Match
    6
    1
    Newcastle Tony
    1
    Newcastle Match
    7
    0
    Sheffield Tony
    0
    Sheffield Match
    8
    2
    Preston Cath
    2
    Preston Match
    9
    6
    Lawnswood Add
    10
    7
    West Park Add
    11
    4
    Liverpool Cath Delete
    Sheet: Sheet1
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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] Compare two columns and return a value in a third column
    By Mr. H in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-09-2018, 01:38 AM
  2. [SOLVED] Compare 2 columns in different sheets and return value of third column in second sheet
    By johnjohnk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-06-2018, 02:39 PM
  3. [SOLVED] Compare 2 columns on different sheets & return current % difference as year progresses
    By Big.Moe in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-31-2013, 03:29 AM
  4. VBA to compare data from two sheets and return value from column based on result.
    By twanbiz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-19-2013, 11:33 AM
  5. Replies: 1
    Last Post: 10-28-2011, 03:13 AM
  6. Replies: 3
    Last Post: 01-20-2011, 11:22 AM
  7. Compare values in 2 columns, return Y/N in a third column
    By creed1101 in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 07-08-2009, 01:29 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