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? - vba

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 (i.e., 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)

Related

Excel - Have a value from column B of a 2 column reference pasted anytime the value from column A is entered on a separate worksheet

In the example I have a 2 column reference where data in column E is correlated to column F. I need the data in Column F to show up anytime data from Column E is entered in a separate worksheet if possible.
To be clear, is it possible to enter data in Column A of Sheet 1 that pulls the correlated data from column B in reference Sheet 2 and enters it into Column B of Sheet 1?
I tried using a simple function in a single sheet but it obviously doesn't do what I need.
You are after VLOOKUP or INDEX MATCH
Sheet1 b1 and fill down rows
=IFERROR(VLOOKUP(A1,Sheet2!E:F,2,FALSE),TEXT(,))
Or
=IFERROR(INDEX(Sheet2!F:F,MATCH(A1,Sheet2!E:E,0)),TEXT(,))
If you set you data up as tables the formulas will autofill down. Rather than use entire columns you can set to the ranges containing data.
Data:

look for Column heading and sum up

I have been working with a excel file with a lot of data, which is arranged in 2 sheets.
I would like to get data from sheet 1 to sheet 2 with reference to the column headings.
For example:
So if I want to find the sum of function 1 person A with criteria 1, the command have to go and find the heading "sum of function 1" in sheet 1 and choose the data that are only under criteria 1 and sum it up in sheet 2 cell D5. (By using column heading reference instead of cell reference).
The table range is A2 : U80.
Thanks.
First you have to format your data as table (select the data -> Menu Insert -> Table). Then you rename your table, for example Table1. Let's say one of the columns you want to sum on the sheet2 is called ColumnName.
On the sheet 2 you write a formula
=SUM(Table1[ColumnName])
The result will be what you are after.
You should try it by SUMIFS(). Syntax will be
=SUMIFS(AgeRange from sheet1,NameRange Sheet1, Name cell Sheet2, PlaceRangeSh1, Place Cell Sh2)
Tell me if requires further help.

how to create a column that only gets the matching value from another sheet in EXCEL

i would like to create an extra column in sheet one which displays a character (for example G) after it finds the matching values from sheet 2.below are two screen shots i have taken for all your conveniences.
please note,in sheet 1 i have marked two rows with identical bs_cd 6374 which matches the bs_cd 6374 in sheet 2 also.what i want is to have a character G in sheet 1 under column G.
thanks in advance
Insert into the cell G2 this formula and drag it down:
=IF(VLOOKUP(B2;Sheet2!$A$2:$A$100;1;FALSE)=0;"";"G")
Change $A$2:$A$100 to your range in sheet2

vlookup if name is matched display employee id

Ive never used vlookups i have a spreedsheet not sure if this is the right function. I have two sheets
Sheet 1
first name last name username
Sheet 2
first name last name employee id business unit
I need in column D on sheet 1 to have employee id ive below. Pay no attention to column letters and sheets because i moved to another sheet to try getting this right.
=MATCH(B11,Sheet1!C:C,0)
Any help is much appreciated.
So you realize you have to match both first and last names? There are several ways to accomplish this depending on how many employees you have in sheet 2: a) small list could a two-column search using array formula; b) large list just create another column in both sheets joining last & first names and do a MATCH or VLOOKUP on them.
Since your needs are simple and to illustrate option (b):
Insert a column in both Sheet1 and Sheet2 after the "last name"; you should now have an empty column C in both sheets.
Assuming you have column headers in row one, and thus data starts in row two, set cell C2 in both sheets with function =B2&","&A2, then fill-down that formula on both sheets in all rows.
Set Sheet1 cell E2 to formula =VLOOKUP(Sheet1!C2, Sheet2!$C:$D, 2, False), and fill-down that formula in all rows.
Voila, employee IDs on Sheet1. I do have to say this is so Excel 101. There are all sorts of examples and tutorials on this easily found using even the most trivial Google searches.

Locate matching values in different XLS sheets and copy other cell values from matching row

Sheet1 column B contains my customer number- I need to locate this customer number in Sheet2 column F. Then copy the value from Sheet2 AE (from the row with the matching customer number) into the matching customer number row in Sheet1 column E. Note that sheet1 column B and Sheet2 column F contain the same customer numbers, but not in the same order and sorting is not an option.
So, after much trial and error I worked out the perfect solution! Thought I'd share just in case anyone else is trying to do the same.
I entered the following into column E:
=INDEX(sheet2!$AE$4:$AE$10000,MATCH(B4,sheet2!$F$4:$F$10000,FALSE)*1)