+ Reply to Thread
Results 1 to 12 of 12

Beginner trying to compare cells in two columns and copy a third column if it is a match

  1. #1
    Registered User
    Join Date
    02-17-2022
    Location
    Sweden
    MS-Off Ver
    Office 2019
    Posts
    6

    Question Beginner trying to compare cells in two columns and copy a third column if it is a match

    Hello, I am a beginner at this so please excuse me if I don't make myself entirely clear but Ill try!

    I want to compare two columns of cell values and when there's a match, a value from a third cell in a third column needs to be copied to a fourth column, right next to the first two columns.
    I am ordering items from a company and I want to match their product number to the amount we want to order. Our ordering systems puts out an excel sheet with prod number in one column and amount we want to order in the column next to it., I want to match two columns containing order number (our systems and the official order form, they use the same formula) and then add our column of "amount ordered" should be added to its respective item row.

    I suspect using MATCH or INDEX is a start but I haven't been able to get it to work.
    Attached Files Attached Files
    Last edited by Bookperson; 02-17-2022 at 10:13 PM. Reason: added file

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,937

    Re: Beginner trying to compare cells in two columns and copy a third column if it is a mat

    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    02-17-2022
    Location
    Sweden
    MS-Off Ver
    Office 2019
    Posts
    6

    Re: Beginner trying to compare cells in two columns and copy a third column if it is a mat

    Done! I've uploaded a shortened version with explanations in the first row.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,937

    Re: Beginner trying to compare cells in two columns and copy a third column if it is a mat

    Still don't understand. There are no matching entries.

  5. #5
    Registered User
    Join Date
    02-17-2022
    Location
    Sweden
    MS-Off Ver
    Office 2019
    Posts
    6

    Re: Beginner trying to compare cells in two columns and copy a third column if it is a mat

    Oops, you're right, I shortened the list and didn't check whether anything actually matched (in the full file there is roughly a thousand product codes in column C, and we're buying maybe 150 of those in varying amounts (listed in Y)
    I have update the file with a better selection of data.
    Last edited by Bookperson; 02-17-2022 at 10:15 PM.

  6. #6
    Forum Contributor
    Join Date
    03-18-2014
    Location
    Singapore
    MS-Off Ver
    Excel 2016 / 2019
    Posts
    251

    Re: Beginner trying to compare cells in two columns and copy a third column if it is a mat

    Hi,

    In C3 enter
    =IFERROR(INDEX($Y$3:$Y$12,MATCH(D3,$X$3:$X$12,0)), "not found")

    and drag down
    Christopher Yap

  7. #7
    Registered User
    Join Date
    02-17-2022
    Location
    Sweden
    MS-Off Ver
    Office 2019
    Posts
    6

    Re: Beginner trying to compare cells in two columns and copy a third column if it is a mat

    That isn't working I believe. It only adds "not found" if a code isn't found, but it doesn't copy the amount I want to order to the C column?

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,767

    Re: Beginner trying to compare cells in two columns and copy a third column if it is a mat

    It works in your sample sheet:

    AliGW on MS365 Insider (Windows) 64 bit

    C
    D
    2
    Order
    Product Code
    3
    not found
    01-05
    4
    not found
    01-07
    5
    not found
    01-08
    6
    not found
    01-10
    7
    3
    66-27
    8
    2
    64-60
    9
    not found
    01-12
    10
    1
    29-37
    11
    not found
    01-14
    Sheet: NE Trade
    Attached Files Attached Files
    Last edited by AliGW; 02-18-2022 at 08:47 AM. Reason: Workbook attached.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  9. #9
    Forum Contributor
    Join Date
    03-17-2010
    Location
    karachi
    MS-Off Ver
    Excel 2003
    Posts
    114

    Re: Beginner trying to compare cells in two columns and copy a third column if it is a mat

    =iferror(index($x$3:$x$11,small(if(isnumber(match($x$3:$x$11,$d$3:$d$12,0)),row($d$3:$d$11)-row($d$3)+1),rows($d$3:d3))),"")

  10. #10
    Registered User
    Join Date
    02-17-2022
    Location
    Sweden
    MS-Off Ver
    Office 2019
    Posts
    6

    Re: Beginner trying to compare cells in two columns and copy a third column if it is a mat

    A huge thank you to everyone, you've saved me a lot of hassle and have been super helpful. As a bonus I learned how to do this now so hopefully I can apply it to other situations in the future.

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,937

    Re: Beginner trying to compare cells in two columns and copy a third column if it is a mat

    You're welcome. Thanks for the rep.

    I feel the other guys did the heavy lifting, but thanks anyway.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  12. #12
    Registered User
    Join Date
    02-17-2022
    Location
    Sweden
    MS-Off Ver
    Office 2019
    Posts
    6

    Re: Beginner trying to compare cells in two columns and copy a third column if it is a mat

    Done and done!

+ 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. Compare columns between two sheets, if match, copy value of another column
    By Cheesecube in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-25-2019, 01:16 AM
  2. Replies: 6
    Last Post: 09-21-2016, 04:21 PM
  3. Replies: 7
    Last Post: 04-18-2016, 02:26 AM
  4. compare two columns on different workbooks and if they match copy one cell.
    By gbest in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-25-2014, 02:59 AM
  5. Compare Columns and Copy if match found
    By betsyroal in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-29-2014, 07:58 AM
  6. [SOLVED] Compare two columns and copy and paste data from a third column when a match is found
    By GatorsBucs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-28-2013, 06:54 PM
  7. Compare Values in 2 columns and Copy the entire row upon match
    By tachytank in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-07-2011, 01:42 AM

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