简体   繁体   中英

How do I copy specific cells from sheet 1 and paste into corresponding rows of sheet 2 , based on values of cells in sheet 2?

I have Sheet 1 with lots of columns, where column A is the list of all customer codes. In sheet 2 I have column A as some selected customer codes. Now based on the selected customer codes in sheet2 I need to extract few columns (H,I,J) from sheet1, paste it into sheet 2 and export the result to a new sheet.

Excel noob here. Hope you understood my query.

Assuming customer codes are unique in column A (ie, the same code does not appear multiple times) you can do all of this with VLOOKUP function.

No need for VBA. In column B, Sheet 2: =VLOOKUP(A1,Sheet1!A:J,8,False) will return the value corresponding from column H (H being the eighth column of the range A:J).

Likewise do this for column I:

=VLOOKUP(A1,Sheet1!A:J,9,False)

And if you guessed also do this for column J:

=VLOOKUP(A1,Sheet1!A:J,10,False)

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