简体   繁体   中英

How to match 2 columns in excel?

I have an excel sheet, sheet1 which has 2 cols, A and B. Col A has some values and has corresponding mapping in col B(not all values in A have a mapping in B, some are empty). The sorting is done from ZA and wrto Col A. I have another excel sheet, sheet2 which has similar Col A and Col B. Now, i want to find out whether any match is there between Col A of sheet1 and Col A of sheet2. If matches are found, those values should be copied onto a new column.

=VLOOKUP(Sheet1!L24,E24:F27,2)

I thought I might give a better explanation because i didn't feel any of these were useful for me to personally figure out VLOOKUP and this answer came up high on list of google when looking for VLOOKUP Examples.

Here is my example which is looking up data from one worksheet to another:

=VLOOKUP(I2,Sheet1!$A$2:$Q$338,2,FALSE)

which is:

=VLOOKUP(<NEEDLE>,<HAYSTACK>,<COLUMN OF HAYSTACK TO PULL BACK INTO LOOKUP COLUMN>,<LEAVE AS FALSE>)

Steps:

  • Select the column which is looked up as the <NEEDLE> eg lookup_value . This might be a list of cars
  • Then select the entire range of the data you want to search within as <HAYSTACK> eg table_array . This is simply a selection of a range of which data to search through. It can be range within the current worksheet , or a range on a different tab/worksheet
  • give a number which is index of column in the Haystack of which column you would like returned as the value. eg col_index_num
  • supply "false" as final paramater. this should always be false at least in the cases I've used it.

I hope that helps someone else.

使用Excel和ADO可以做很多事情: Excel VBA可以使行匹配并排成一行

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM