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

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

Related

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.

Compare two columns then add another if the data is the same

I have two separate worksheets that I would like to search in and then populate a column if two columns represent the same data. I'm having a hard time explaining this so please have patience.
I have worksheet1 with column "A" having text and numbers in it. In the same sheet column "B" has the data that I want to show in worksheet2 if Both Column "A" match in both worksheets.
Example:
Worksheet1
Column A
Text text text (2012-R-0000)
blah blah blah
text text text (2012-R-0001)
Column B
20-204
20-405
40-609
Worksheet2
Column A
2012-R-0000
2012-R-0001
Column E
(empty) I would like the data in Worksheet1 Column B to be placed here.
Thank you in advance for any assistance with my question.
Assuming your worksheet 1 and worksheet 2 datas starts with A1
use the below formula at worksheet 2 in E1
=VLOOKUP("*"&A1&"*",Sheet3!A:B,2,FALSE)
French Formula:
=RECHERCHEV("*"&A1&"*";Sheet3!A:B;2;FALSE)
and drag down
Proof of Work
Use VLookUp in Worksheet 2 like this.
In cell E1 of Worksheet 2 write the following:
=VLOOKUP(A1;Worksheet1!$A$1:$B$30;2;FALSE)
Then simply drag the formula down. It will match the first column from both worksheets, then paste the corresponding data from column B in worksheet1 to column E in worksheet 2. You'll have to edit "Worksheet1" to match the name of the acctual worksheet, and the number 30 to match the number of rows in worksheet 1.

If value match on different sheet, then copy data from the sheet one to other sheets

I have Sheet1, Sheet2, Sheet3, Sheet4
I want the formula i.e. if I enter any value in Sheet2, Sheet3, Sheet4 in Column E, then it should match that value with Sheet1 Column A, In case of value match, the data value of sheet1 should be copied to all other sheets.
EG:- In sheet1 I have the below mentioned data.
(A Column / B Column / C Column)
(Product Value / Cost / Packing)
(200 / 100 / 50)
(150 / 70 / 20)
(300 / 120 / 50)
(500 / 300 / 100)
To illustrate, if in Sheet2, Column E if I put a value 150, then the formula should scan for that value in Sheet1, Column A , and find its match in 2nd row, then it should copy the data of column B (i.e 70) to Sheet2 column N and similarly copy the Sheet1 column C (i.e 20) to Sheet2 column O.
If I enter value to Sheet2, Sheet3, Sheet4, Sheet5 then formula should scan the value only from Sheet1 and copy the data,to its respective places as described in the preceding paragraph.
This is relatively simple and straight forward to do with vlookup.
I am making the assumption that the value to lookup is in Cell E2 (regardless of the sheet)
Use the following formulas for Column N2 on Sheet2,3,4,5, etc and then drag down to how many rows as needed:
=VLOOKUP(E2,Sheet1!$A$2:$C$5,2,FALSE)
Use the following formulas for Column O2 on Sheet2,3,4,5, etc and then drag down to how many rows as needed:
=VLOOKUP(E2,Sheet1!$A$2:$C$5,3,FALSE)
Adjust the "$A$2:$C$5" formula part to match the appropriate range in your Sheet1 table. Or replace the "5" with the number of rows with product data in Sheet1. You can also use "Sheet1!A:C" to just search all the rows.
This formula does not "copy" the data to the other sheets, it merely displays the value based on the lookup value in column E.
The first argument of VLOOKUP is the Lookup value (the "product value"). We want to reference the cell in column E for this. (I used Cell E2, as I assume you have a column header in E1).
The second argument of VLOOKUP is the Table array (Sheet1!$A$2:$C$5). This is where we want to look for our value from column E. Keep in mind, vlookup only searches thru the first column for the criteria value. The dollar signs ($) make sure that the lookup table reference stays static and does not change if you try to autofill the formula down all the rows in your column.
The third argument of VLOOKUP is the column index. When it finds a match in the first column, this integer will tell vlookup which column to return. 1 returns the 1st column, 2 returns the 2nd, and so on.
The "FALSE" parameter tells the formula to only find exact match. If this is set to "TRUE" and your list is not sorted in ascending order, you will run into trouble with vlookup trying to find the closest match rather than an exact match.

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 (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)

Copy corresponding values from reference to a new list in Excel 2007

I hope somebody can help me; I've been trying to figure out how to do this all day long.
I have one sheet with a list with corresponding values, e.g. Columns A, B, C make a group of values that have to be together.
In another sheet, I have some values from Column A, but not all of them, and want to automatically add the corresponding columns B and C to it.
So I thought about making a macro that copies the first value from Column A in the incomplete sheet, searches for it in the reference sheet, copies the corresponding values from B and C, pastes them next to A in the incomplete sheet, then copies the next value from A and searches for it in the reference table, and so on...
I tried but couldn*t make it work - any ideas? I've wasted way too much time on that problem already! Would do it by hand but have like 40,000 rows of data.
If you know how to do it, help would be MUCH appreciated.
Based on these assumptions:
Complete data is in Sheet1, columns A:C starting at row 2 (Headings in row 1)
Incomplete data in sheet2, column A starting at row 2 (Headings in row 1)
put this formula in sheet2 cell B2
=VLOOKUP($A2,Sheet1!$A:$C,2,0)
put this formula in sheet2 cell C2
=VLOOKUP($A2,Sheet1!$A:$C,3,0)
copy these formula down for as many rows as you have data
you can leave the formulas in place, or copy paste values to make permanent