Excel match product id from two worksheet and take the price value - excel

I have two worksheets,
Sheet1
ID DESCRIPTION COLUMN C
AABBCC jacket
BBCCAA shirt
CCAABB shoes
Sheet2
ID PRICE
AABBCC 100
BBCCAA 50
CCAABB 230
If the id of sheet1 match with id of sheet2 extract the price from sheet2 and write in column c of sheet1

Or use Index and Match
In C2 put
=IFERROR(INDEX(Sheet2!$B$2:$B$4,MATCH(A2,Sheet2!$A$2:$A$4,0)),"")
And drag down. Be sure to edit $B$2:$B$4 and $A$2:$A$4 to match your actual ranges.

Related

Copy a cell value from one sheet to another when a condition is met

I have a google spreadsheet with two tabs, Sheet1, Sheet2.
Sheet1 contains two columns ID and Value
Sheet2 contains a column ID.
I need a formula where if ID of Sheet2 is present in Sheet1, retrieve the "Value" of that particular row.
With the following VLOOKUP formula, I was able to find out whether the IDs of sheet2 are present in Sheet1 or not. I need the help in obtaining the Value of the matched row.
My formula: =IF(ISERROR(VLOOKUP(A2,Sheet1!A:A,1,FALSE)),FALSE,TRUE)
Sample Data Sheet 1
ID Value
123 Apple
456 Samsung
789 Oneplus
Sample data Sheet 2
ID Value
13
123
456
Expected Data in Sheet 2
ID Value
13
123 Apple
456 Samsung

Excel IF Formula 3

I have a sheet with rows of data that I want to copy to a different sheet if the name in column a equals a certain value. For example:
A | B | C
Name | Color | Amount
Sue | Blue | $400
Joe | Green | $1000
Sheet Sue needs to bring columns B and C from Sue's records to it's worksheet if column a equals Sue
Sheet Joe needs to bring columns B and C from Joe's records to it's worksheet if column a equals Joe
and so on and so forth...
Can anyone help!?
Well, if you don't have too much data you can do this with array formulas.
Set up your main sheet (assuming it's Sheet1) with named ranges. Your A2:A100 name it Name, B2:B100, name it Color, and C2:C100 name it Amount. (Adjust the range as necessary)
Then, in each of the people's sheets, have header rows called Name, Color, and Amount. Then you can use this formula (entered with CTRL+SHIFT+ENTER):
=INDEX(INDIRECT(A$1),SMALL(IF(INDIRECT($A$1)=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255),ROW(INDIRECT($A$1))-ROW(Sheet1!A$2)+1),ROWS(Sheet1!$A$2:A2)))
Wrap IFERROR([formula],"") to hide the #NUM errors when you reach the end of the data.

text matching with logical function?

Please help me to formulate the following formula:
Actually I am trying to make a costing sheet for recipes.. I am listing all the items in sheet 1 and on sheet 2 all recipes with their quantities of items..
sheet 1
A B
1 item price/gm
2 chicken 10
Sheet 2
A B C
1 item Qty (in gm) cost
2 chicken 150 formula?
now in sheet 2 C2 I need a formula that matches sheet2 A2 with sheet1 column A and then multiply sheet2 B2 with sheet1 B2.. and this will same for all the items in sheet2.. if I put any item in sheet2 it looks up in sheet1 and then multiply the price with qty in sheet2..
Use VLOOKUP:
=B2*VLOOKUP(A1,'Sheet 1'!A:B,2,false)

INDEX MATCH obtaining values for duplicate names

I have one example table with the following data in Sheet1 with the following random data
------A ----------------- B ----------------------C ------------------------D
1 --First--------------Last-----------------Start Date--------------End Date
2 --John--------------Smith--------------08/08/2014------------01/01/2015
3---John--------------Smith--------------08/11/2014------------17/11/2014
4---John--------------Smith--------------06/06/2014------------23/12/2014
5---Abel--------------Jones--------------14/05/2014------------29/04/2015
6---Abel--------------Jones--------------04/07/2014------------26/04/2015
Then I have another table in Sheet2
------A ----------------- B ----------------------C ------------------------D
1 --First--------------Last-----------------Start Date--------------End Date
2 --John--------------Smith---------------------------------------------------
3---John--------------Smith---------------------------------------------------
4---John--------------Smith---------------------------------------------------
5---Abel--------------Jones---------------------------------------------------
6---Abel--------------Jones---------------------------------------------------
I am using INDEX MATCH to transfer the data between the two sheets.
=INDEX(Sheet1!$C:$C,
MATCH(1,INDEX((Sheet1!$A:$A=$A3)*(Sheet1!$B:$B=$B3),0),0))
To populate column C with the start dates from Sheet1.
=INDEX(Sheet1!$D:$D,
MATCH(1,INDEX((Sheet1!$A:$A=$A3)*(Sheet1!$B:$B=$B3),0),0))
and this to populate column D with the end dates.
The problem is, when I perform this INDEX MATCH function, for a duplicate name, it will only copy over the first value. So this formula will paste 08/08/2014 into all 'John Smith' Start dates in column C of Sheet2.
How do I obtain all values so that C2 should be 08/08/2014, C3 should be 08/11/2014, C4 should be 06/06/2014 etc.
One solution would be to insert a column in both sheets with a "running count" of instances of the same name. For example, insert col C and in C2 enter =IF(A2&B2 = A1&B1, C1+1, 1). This starts the count at 1 if the concatenated first and last name is new, and increases the previous count by 1 if not. So you would have
First Last Count by Person
John Smith 1
John Smith 2
John Smith 3
Abel Jones 1
Abel Jones 2
George Washington 1
Thomas Jefferson 1
Thomas Jefferson 2
You can then add this column to your MATCH() function (and change the lookup column as necessary).
Edit: It is worth noting that this requires your raw data is sorted by name.
You can narrow the $A:$A refferances to something like $Ax+1:$Ay where y = last row of your excel sheet and x is position of previous occurance of this name/surname (you could store this in some dummy column).

Identify matching numbers and then imput a value from a different column

I have two sheets, Sheet1 and Sheet2. Sheet1 has a list of company names in column A, Revenue in column B and a unique number identifier in column D (also seen as "unique #forAAA in Sheet2). In Sheet2, I pulled a list from Hoovers, and the format comes up something like below (so this format should not be changed).
Column A B C D
Company Name Place Type of Comp Revenue
1 AAA US HQ 10.0 M
2 unique #forAAA
3 BBB India Branch 5.0 M
4 unique #forBBB
What I'd like to do is match the unique number for each company between Sheet1 and Sheet2 and then put the revenue # from Sheet2 into column B of Sheet1 which corresponds to the correct #. I'm pretty lost here, so any help or ideas would be great. Thanks for your help!
Because the unique identifier is on a different row than the result to be returned, you can use a variation using INDEX and MATCH:
=INDEX(Sheet2!D:D, MATCH(D2, Sheet2!A:A, 0)-1)
INDEX will return the value within range Sheet2!D:D on row MATCH(D2, Sheet2!A:A, 0)-1.
MATCH(D2, Sheet2!A:A, 0) will give you the row number where the unique ID is found, then -1 to get the row number of the revenue amount.
EDIT: As per comment, to remove the M, you can use this:
=TRIM(SUBSTITUTE(INDEX(Sheet2!D:D, MATCH(D2, Sheet2!A:A, 0)-1),"M",""))
I would put the unique value in a column inserted before A (would be the new column A) instead of putting it below each row. Then, in the other sheet I'd put the VLOOKUP like this:
=VLOOKUP(D2,Sheet2!A:E,5,0)
That should return the value in column E (column D before the column insertion, i.e. revenue for the unique company identifier).
Note that the third argument in the vlookup function is the number of the column you want to be retrieved, so the range defined in the second argument (Sheet2!A:E) should contain that column.

Resources