+ Reply to Thread
Results 1 to 21 of 21

Compare two columns of data and output contents of a third column when there is a match

  1. #1
    Registered User
    Join Date
    04-11-2018
    Location
    Cheshire
    MS-Off Ver
    2010
    Posts
    8

    Compare two columns of data and output contents of a third column when there is a match

    Hi, I'm trying to develop a report which looks at two columns of part numbers which have a corresponding prices in a third column. The first column is imported and can vary from month to month. The second column is for reference and is static. This is the formula I've got which only partially works (don't know why it sometimes works and sometimes not??). Column C contains the prices and I want to match Column A with Column B
    =INDEX(C1:C385,MATCH(A2,B1:B500,1)).

    Been on this for nearly 3 days and if I had any, I'd have pulled my hair out by now!! Any help will be appreciated.

    Many thanks
    Attached Files Attached Files
    Last edited by BENTLEY1984; 04-11-2018 at 08:18 AM.

  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,916

    Re: Compare two columns of data and output contents of a third column when there is a matc

    Will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture of one and nobody wants to have to recreate your data from scratch.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired results are also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    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
    04-11-2018
    Location
    Cheshire
    MS-Off Ver
    2010
    Posts
    8

    Re: Compare two columns of data and output contents of a third column when there is a matc

    Thanks AliGW,
    I've attached the .xlsx file now.

  4. #4
    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,916

    Re: Compare two columns of data and output contents of a third column when there is a matc

    Sorry - I don't see any attempt at a formula there. Is it the booking cost you want to search for? If so, where have the three manually entered results come from?

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Compare two columns of data and output contents of a third column when there is a matc

    One problem is the column A entries do not match B:

    "F1 102" in A but these are of the form "F1-102" in B

  6. #6
    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,916

    Re: Compare two columns of data and output contents of a third column when there is a matc

    It's a very odd layout!

  7. #7
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Compare two columns of data and output contents of a third column when there is a matc

    Maybe try this

    Power Query for

  8. #8
    Registered User
    Join Date
    04-11-2018
    Location
    Cheshire
    MS-Off Ver
    2010
    Posts
    8

    Re: Compare two columns of data and output contents of a third column when there is a matc

    sorry, I think you may have already answered my question. I forgot that the formatting had to match. The formula I tried is in my original message. I manually typed what the results should be. I'll try reformatting the contents of Column B and see how I go on. If I've got any more issues I'll repost.

    Thanks.

  9. #9
    Registered User
    Join Date
    04-11-2018
    Location
    Cheshire
    MS-Off Ver
    2010
    Posts
    8

    Re: Compare two columns of data and output contents of a third column when there is a matc

    Thanks sandy666, I'll see if I can get the add in

    Cheers

  10. #10
    Registered User
    Join Date
    04-11-2018
    Location
    Cheshire
    MS-Off Ver
    2010
    Posts
    8

    Re: Compare two columns of data and output contents of a third column when there is a matc

    unfortunately reformatting column B Made no difference. Am I trying to do the impossible here??
    Attached Files Attached Files
    Last edited by BENTLEY1984; 04-11-2018 at 09:34 AM.

  11. #11
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: Compare two columns of data and output contents of a third column when there is a matc

    Sure

    in the meantime you can see result (how it works you can see if you have add-in)
    Attached Files Attached Files

  12. #12
    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,916

    Re: Compare two columns of data and output contents of a third column when there is a matc

    No - attach the newly reformatted workbook.

    Your layout is very odd, though.

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Compare two columns of data and output contents of a third column when there is a matc

    What is wrong with attached?
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    04-11-2018
    Location
    Cheshire
    MS-Off Ver
    2010
    Posts
    8

    Re: Compare two columns of data and output contents of a third column when there is a matc

    the formatting of the text in Column A doesn't match Column B. I've rectified this in my latest upload

  15. #15
    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,916

    Re: Compare two columns of data and output contents of a third column when there is a matc

    Is this solved? It's marked as such, but your comments don't make this clear.

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Compare two columns of data and output contents of a third column when there is a matc

    In D2

    =INDEX($C$2:$C$500,MATCH(A2,$B$2:$B$500,0))

  17. #17
    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,916

    Re: Compare two columns of data and output contents of a third column when there is a matc

    You need this:

    =INDEX($C$2:$C$385,MATCH(A2,$B$1:$B$500,0))

    NOT this:

    =INDEX($C$2:$C$385,MATCH(A2,$B$1:$B$500,1))

    0 = exact match
    1 = approximate match

  18. #18
    Registered User
    Join Date
    04-11-2018
    Location
    Cheshire
    MS-Off Ver
    2010
    Posts
    8

    Re: Compare two columns of data and output contents of a third column when there is a matc

    Sorry Ali, I'm new to the forums. John Topley has responded asking what was wrong with the attached. I've opened the sheet and the formula works on there??? I've copied it into my working document and everything is fine. So frustrated that I've spent so much time on this and I don't know why it didn't work in the first place. Thanks for your help, patience and support :-)

  19. #19
    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,916

    Re: Compare two columns of data and output contents of a third column when there is a matc

    See post #17.

    Yes, I can see everything in the thread!!!

  20. #20
    Registered User
    Join Date
    04-11-2018
    Location
    Cheshire
    MS-Off Ver
    2010
    Posts
    8

    Re: Compare two columns of data and output contents of a third column when there is a matc

    Great thanks again for your trouble :-)

  21. #21
    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,916

    Re: Compare two columns of data and output contents of a third column when there is a matc

    No problem.

+ 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] How to compare data from two columns if match get the result from third column
    By devawad in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-06-2017, 12:43 AM
  2. how to compare 2 columns & output 3rd column
    By Babylon65 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-10-2016, 12:35 PM
  3. [SOLVED] Compare Data in 2 Columns in 2 sheet When there is a match transfer data from 2nd Column
    By kellyjo7 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-19-2015, 01:05 PM
  4. [SOLVED] macro to compare two columns, and then output an answer into a different column.
    By emilyloz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-31-2013, 09:50 AM
  5. [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
  6. Compare the two columns and display the 2nd column item as output
    By gurum in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-25-2013, 07:58 AM
  7. Compare 2 columns and output to a 3rd column
    By jamaican jewel in forum Excel General
    Replies: 1
    Last Post: 03-22-2006, 05:30 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