What formula do I use to get the answer from sheet 2, column B into sheet 1, column R, by having the part number be the only link to both sheets? - excel

enter image description hereWhat formula do I use to get the answer from sheet 2, column B into sheet 1, column R, by having the part number be the only link to both sheets?
I need to get the pre-set cost value in sheet 2 into an ever-changing sheet 1 spreadsheet. The cost stays the same-sheet 2 is my legend, but different numbers are in-putted into sheet 1 all the time, and I want the cost to automatically populate from sheet 2 into sheet 1. Each number needs a cost.
Example:
Sheet 1:
Column A Column R
3568 (need formula to = 7.30)
1660 (need formula to = 1.50)
Sheet 2: Numerical-Once and a while new numbers will be added
Column A Column B
0270 2.20
1660 1.50
2610 8.00
3568 7.30
Where 0270 = 2.20, 1660 = 1.50, and so on...
Thanks in advance!

Try this formula in column R, starting in row 2
=vlookup(A2,Sheet2!$A$1:$C$1000,2,False)
If you omit the last parameter, it defaults to TRUE, which requires the data to be sorted and will return an approximate match if no exact match is found.
Also, if you copy the formula down, make sure that the lookup range has absolute references for columns AND rows, i.e. Sheet2!$A$1:$C$1000 and NOT Sheet2!$A1:$C1000

Related

Match descriptions and copy/paste associated quantity

In Sheet 1, column A contains a list of product names and column B a list of quantities. The number of rows is variable and could be a minimum of 1 and a maximum of 15 (from row 62 to 76 - blank rows are automatically hidden). In Sheet 2, column A contains the same product list, but all 15 of them, ie Sheet 1 is a dynamic range and Sheet 2 is a static range. I am attempting to set up a VBA procedure whereby the macro will match the product in column A62 (Sheet 1) with column A4-18 (Sheet 2), copy the corresponding quantity from column B in Sheet 1 to column B in Sheet 2 and then move down the product list in Sheet 1, doing the same till it reaches the end of the dynamic range.
If anyone can assist or point me in the right direction, I'd be very grateful. Many thanks.

How do I convert rows to columns, and repeat the adjacent cells?

I'm sorry if the title is confusing, but a visual should hopefully help:
Here's what my sheet looks like:
A B C D
1 x y z t
2 q w e r
3 y u i o
I need to generate a separate sheet wherein:
A B C
1 x y t
2 x z t
3 q w r
4 q e r
...
Basically, I need the middle two columns of the original sheet to be transposed and the adjacent columns to it pulled into my new sheet as well (as duplicate rows).
I have the transpose working correctly, and when I pull the adjacent columns that works too. The issue is, I can't autofill the sheet. When I try to drag & autofill, instead of autofilling using row 2 from the original sheet, the new sheet will autofill using row 3 (which is the same row # in the new sheet).
Please let me know if this isn't making sense, I'll try to explain better! I'm not very well versed in the Google Spreadsheets scripts - I've tried before but they seem rather cumbersome. But I'm happy to try that as well.
I'm not sure where a transpose operation would come into play but a little conditional maths and the INDEX function¹ should suffice.
=INDEX($A$1:$D$3,(ROW(1:1)-1)/2+1,IF(COLUMN(A:A)=3,4,IF(AND(ISEVEN(ROW(1:1)),COLUMN(A:A)=2),3,COLUMN(A:A))))
The documentation I've linked to is Excel but the syntax is identical for these purposes.
Addendum for more columns
By adjusting the condition for the offset after the third column, more columns can be readily accounted for.
=INDEX($A$1:$J$3,(ROW(1:1)-1)/2+1,IF(COLUMN(A:A)>=3,COLUMN(A:A)+1,IF(AND(ISEVEN(ROW(1:1)),COLUMN(A:A)=2),3,COLUMN(A:A))))
The above collects 10 columns from the source matrix but should be auto-adjusting for pretty much any number of columns.
¹ The INDEX function accepts parameters for both row number and column number. Although typically only one of these is used, there is no restriction against supplying both against a 2D range of cells.
Put the row_number calculation,      =(ROW(1:1)-1)/2+1 into a cell and fill down. You will receive 1, 1, 2, 2, 3, 3, etc. This supplies the repeating row number from the A1:D3 range.
Put the column_number calculation,      =IF(COLUMN(A:A)=3,4,IF(AND(ISEVEN(ROW(1:1)),COLUMN(A:A)=2),3,COLUMN(A:A))) into a cell and fill right and down. You will receive 1, 2, 4 for the first row and 1, 3, 4 for the second. This pattern repeats itself for subsequent rows and supplies the offset column numbers from the A1:D3 range.
You can do this with 3 single arrayformulas that are dynamic to work with any number of rows of data:
Here is an image to demonstrate:
The three formulas are:
CELL A1:
=TRANSPOSE(SPLIT(JOIN(";",ARRAYFORMULA(REPT(Sheet1!A1:A&";",2))),";"))
CELL B1:
=TRANSPOSE(SPLIT(JOIN(";",ARRAYFORMULA(Sheet1!B1:B&";"&Sheet1!C1:C)),";"))
CELL C1:
=TRANSPOSE(SPLIT(JOIN(";",ARRAYFORMULA(REPT(Sheet1!D1:D&";",2))),";"))

Excel formula for multiple conditions and worksheets

The aim
I am try to create a formula which will allow specific information from 90 different worksheets, with an example of one such worksheet being below. Each work sheet represents data from a participant.
I want the data from the 90 work sheets to be summarised into the worksheet below.
The problem
The problem is that I need to create a formula that takes counterbalancing into account.
So in cell A3 of the second image I would to record the number of times the value 1 and 3 appears in column I of the first image.
The conditions
However, I would only like the numbers in column I to count if:
a) in column M of image 1 there is a value of 1
and
b) when the number in Column L is 1 and Column K is 1 or 4 OR when the number in Column L is 2 and the number in Column K is 3 or 4.
My attempt
=SUM('[All_memories_301-389_improved.xlsx]Sirma 301:387Yanxin'!$M$2,1*(IF('[All_memories_301-389_improved.xlsx]Sirma 301:387Yanxin'!$L$2,1*(IF('[All_memories_301-389_improved.xlsx]Sirma 301:387Yanxin'!$K$2:$K$41,1,4*(IF('[All_memories_301-389_improved.xlsx]Sirma 301:387Yanxin'!$I$2:$I$54,1,3)))))))
This did not work however and I have spent a long time on this and made changes but I still can't seem to get it to work.
Extra information:
In column I I want to count all the occurrences of 1 and 3 provided the specified conditions are met. The rows are not important, but rather, the column I information for each of the 90 spreadsheets.
New attempt with formula:
=COUNTIFS('[All_memories_301-389_improved.xlsx]381Christie'!$M$2, 1, '[All_memories_301-389_improved.xlsx]381Christie'!$L$2, 1, '[All_memories_301-389_improved.xlsx]381Christie'!$K$2:$K$23, AND(1,4), '[All_memories_301-389_improved.xlsx]381Christie'!$I$2:$I$23, AND(1,3))

Need to match data in different sheets and replace data in another cell if it's a match

I need to match data in column A2 and so on in sheet 1 to data in column A2 and so on in sheet 2. If the data in column A of sheet 1 and sheet 2 match I need the data in column B & C of sheet 2 to replace data in column B & C of sheet 1. I know VERY little about doing this kind of stuff so any help would be GREATLY appreciated!
SHEET 1
A B C
2 12345 5.35 9.95
3 15874 4.22 10.99
4 11111 2.24 5.99
5 98745 5.33 9.95
6 88552 4.24 8.95
SHEET 2
A B C
2 11111 2.09 5.79
3 12345 5.11 9.89
4 88552 4.01 8.79
NEED SHEET 1 to change to
A B C
2 12345 5.11 9.89
3 15874 4.22 10.99
4 11111 2.09 5.79
5 98745 5.33 9.95
6 88552 4.01 8.79
On a third sheet use these functions
column a ='sheet1'!a2
column b =if('sheet1'!b2='sheet2'!b2,'sheet2'!b2,'sheet1'!b2)
column c =if('sheet1'!c2='sheet2'!c2,'sheet2'!c2,'sheet1'!c2)
Copy sheet3 and paste the values into sheet1.
This should work unless column a does match. or if you need to do this dynamically. If column a doesn't match some vlookups can be thrown in.
I your data does match in column a your formulas could look something like this.
column a ='sheet1'!a2
column b =if(not(iserror(vlookup(a2,'sheet2'!a:c,2,false))),vlookup(a2,'sheet2'!a:c,2,false),vlookup(a2,'sheet1'!a:c,2,false))
column c =if(not(iserror(vlookup(a2,'sheet2'!a:c,3,false))),vlookup(a2,'sheet2'!a:c,3,false),vlookup(a2,'sheet1'!a:c,3,false))
this is too much to put in a comment so I'm putting it in answer.
The way I under stand is, since sheet1 has more data, you only want to be doing this comparison when sheet1 and 2 both have data on the row. so If sheet1 has data in rows 1 - 100, and sheet2 has data in rows 1 to 50, you only want to be doing this comparison for the first 50 rows in sheet1 right?
So, rather than copying and pasting formulas, what you can do is, in sheet1, find an unused column. go to the first row. in the formula box, type: "=if(" without the quotes. now, select the first cell to compare, according to your example you'd select sheet1, A2. then type "=" without quotes. then select the second cell you want to compare - in your example, sheet2, A2. then type "," without quotes. then select the cell from which you want the data if the first 2 cells are equal. in your example, sheet2 B2. then type "," without quotes, then select the cell with the data to use if the first 2 cells are not equal. in your example, sheet1 b2. then type ")" without the quotes.
so using your example, the function would look similar to how bigtree had it: =if('sheet1'!A2='sheet2'!A2,'sheet2'!b2,'sheet1'!b2)
so, this will compare sheet1 cell A2 with sheet2 A2 and if they are equal, the cell you put the formula in will the have the value of sheet2 b2, and if they are not equal, the cell with this formula will have the value of sheet1 B2. then, drag this formula down for however many rows you want, and the formula will adjust automatically for each row. you'll see the numbers increase. then, select the column with the formulas, right click and select copy, then right click and go to paste special, and click values. this will make it so the column contains only the values, not the formulas, now you can paste this data in column B sheet 1.
you can reuse this formula for whatever columns, just follow the steps.
HTH, good luck!

Find value in 2D array and return value in adjacent cell

**Sheet 1**
ColumnA B C D E F G H
------------------------------------------------------------
EURUSD 1.2765 1 ACCOUNT624 2 account125 1 account834
EURCAD 1.01 2 Account49 3 account45 2 account67
EURGBP 0.78 2 Account777 1 account45 2 account678
**Sheet 2**
ColumnA B C D
---------------------------------------
EURUSD 1.2765 Account 624 ?
EURUSD 1.2765 Account 125
EURUSD 1.2765 Account 834
EURCAD 1.01 Account49
EURCAD 1.01 Account45
In Sheet 1 above each row shows a currency trade and what quantity goes to each account.In Sheet 2 each row shows 1 account only. I would like to populate columnd D in sheet 2 with the quantites from sheet 1.
Breaking it up into steps, i would like to:
Find the price in Sheet2!B1 in sheet1
On the same row in sheet1, find the cell containing the same account as Sheet2!C1
Return value in cell to the left of cell with matching account
I have used index/match before but I can't get it to work for 2 dimensional arrays. Can anyone help with a formula? Thanks in advance!
It's not pretty, but using what you requested - to find the match based upon price in column B (I would say your safer bet would be to use the Currency conversion "EURUSD", for example, since what if 2 currencies have the same ocnversion rate??), paste this formula in cell D1 on your second sheet:
=OFFSET(Sheet1!$B$1,MATCH(B1,Sheet1!$B$1:$B$3,0)-1,MATCH(C1,OFFSET(Sheet1!$B$1,MATCH(B1,Sheet1!$B$1:$B$3,0)-1,0,1,10),0))
You can then drag it down / change ranges as needed.
(PS - I'm also assuming you made a mistake on sheet2 and that the account numbers will be typed the exact same in both sheets)

Resources