Get referenced sheet - excel

I want to get the value in a column next to a referenced cell
Example
Sheet Products
A1 = "test"
B1 = "next test"
B2 = "last test"
Sheet Totals
First i get the referenced cell in CEll A 1
A1 = =CELL("address";INDEX(Products!A:A;MATCH(C5;Products!A:A;0);0))
// returns Products$A$1
Now i want to get the value of B1,B2 and so on... based on what is in A1
I know with Indirect(A1) i will get the value of the referenced cell...but i have no clue how to get next to that one and so on....

You can use OFFSET function. The OFFSET function returns a cell or range of cells that is a specified number of rows and columns from a cell or range of cells.
For example, if =INDIRECT(A1) in Sheet Totals gives you test (which is Cell A1 in Sheet Products) as result then to get value of Cell B1 from Sheet Products you'll have to use =OFFSET(INDIRECT(A1),0,1) (same row, next column). Like wise, for Cell B2 from Sheet Products you'll have to use =OFFSET(INDIRECT(A1),1,1) (next row, next coulmn).
For details on OFFSET function see this.

Related

Excel - Look through value for a particular column and paste in another sheet

I have a column with cells value is either 1 or empty / 0
I want to loop through individual cell from B4 to B50 to check the value in this sheet called "Data".
If value is 1, then copy the cell content on the left (A4) to another sheet called "Main" at B2.
While copying, it need to check the cell (B2) is empty, if not, check next B3, B4 and paste to next empty cell.
Pasting into cell should retain the format of the words (e.g. Bold,italic, if there is) and colour of the cells that is copying from.
Then return to "Data" sheet and resume checkin for value 1. Loop until B50.
Appreciate using excel 2016 VBA. I tried a few type of codes but remain error.

Copy the formula in Excel as it is done by dragging the cell over to another

For i = 1 To staffelRange.Rows.Count
.DataBodyRange.Cells(i, countHeader).Formula = staffelRange.Cells(i).Formula
Next
the code works as intended and copies the formulas from my range into the desired range in my table. first to the formula, the formula always refers to the column header and the cell left of it, if i copy the code now with my function from column 1 to for example column 4, the formula still refers to column 1 instead of column 4. but if i copy it by dragging the formula over to the other cell, the formula adapts. How can I achieve such an adjustment in my code?
Formula:
=$G39*(1+SVERWEIS(Stückpreise_neu_19[[#Kopfzeilen];[Staffel1]];Rabattstaffel_new_24;2;FALSCH))
If the formula is always the same except for the cell reference, you can just write the formula to sheet as a string value with a variable for the correct row number.
Something like...
For i = 1 To staffelRange.Rows.Count
.DataBodyRange.Cells(i, countHeader).Formula = "=$G" & i & "*1+SVERWEIS(Stückpreise_neu_19[[#Kopfzeilen];Staffel1]];Rabattstaffel_new_24;2;FALSCH))"
Next
This is assuming your variable i represents the correct row number for the formula (which to my understanding is correct).

Best formula to use for summing multiple column returns 1 row down from search value

I need to copy over data from one worksheet to a master worksheet. I do this with a new created worksheet every week. The new worksheets I create every week use the same cell layout so I would need to use a formula that I can copy and paste on the master worksheet.
The values I need to return and sum are 1 row below the lookup_value that I would normally use in Vlookup; they are also 8 columns across.
lookup_value is in cell A138, Values to return and sum are in cells H139:P139.
These are the same cells every worksheet.
I've tried to use variances of Sum(Vlookup($H$139:$P$139,{8,9,10,11,12,13,14,15,16} & Index(Match but continue to get #REF! or #Value!
what formula structure can I use to lookup_value and return 1 row below and sum columns H - P?
Image 1 of "Master Worksheet" formula is located in cell I1996 under "Qty in Transit" This row is in reference to Part # A03781402 shown on the right.
Image 2 of "Worksheet 1" You can see where Part # A03781402 is referenced in cell A138. Now I just need to grab the Qty from Cells H139:P139, sum & return to "Master Worksheet" Cell I1996
Formula for 'Master Worksheet'!I1996 to sum 'Worksheet 1'!H:P one row below the row that matches 'Master Worksheet'!R1996 in 'Worksheet 1'!A:A.
=sum(index('Worksheet 1'!H:P, match(R1996, 'Worksheet 1'!A:A, 0)+1, 0))
The 0 as the column_num in INDEX is important; it means all columns within the indexed range.
You need to use something like a SUMIF:
=SUMIF($H$138:$P$138,$A$138,$H$139:$P$139)
If the lookup_value is in Z1 and the lookup_array ColumnA, then please try:
=SUM(INDEX(H:P,1+MATCH(Z1,A:A,0),))

Autofill Excel if A1 = sheet2 A1 then B1 = Sheet2 B2

I am maintaining an excel sheet where Sheet1 A1 would be the name of people and B2 would be their contact number. All of the details are in sheet 2 row A and B.
So, what I want is if I put a valid name (i.e. should be in Sheet2 A) then it automatically finds the number of that name and adds in the second row. Is this possible? I have around 10-15 contacts there.
Assuming Sheet workers list is as follows:
then in Cell B2 of Sheet assignment received enter either of the following formulas
=VLOOKUP(A1,'workers list'!A2:B10,2,FALSE)
or
=INDEX('workers list'!B2:B10,MATCH(A1,'workers list'!A2:A10,0))
Change range as required.
Use this formula in sheet -1 B2 cell "=IF(A2="","",VLOOKUP(A2,Sheet2!$A:$B,2,0))"
and Dropdown this formula till you want
Sheet-2
Sheet-1

If cell A1 in sheet 1 equals 'x' like in sheet 2, then display cell B1 from sheet 2 in sheet 1 cell C2

This might be confusing but I'll give this a go.
As in the title of this question, I need to link cells between two sheets. Seems simple enough, but I think in this case I need to include an IF function?
I want cell C2 in sheet 1 to display what is in cell B2 from sheet 2 IF cell A1 in sheet 1 is the same as cell B1.
In other words: I have 2 sheets, on the second page I have months in on row and in the row under I have values for those months. I want to be able to link sheet 1 and 2 so that if I select February in one cell in sheet 1, then the cell under February in sheet 2 (the value) is shown in another cell on sheet 1.
Help please?
I think the relationships are satisfied by:
=IF(A1='sheet 2'!B1,'sheet 2'!B2,"")
(in Sheet 1!C2) but have assumed that the result should be nothing if Sheet 1!A1 != Sheet 2!B2.
I think you might be looking for in cell C2 (if you are talking about A1 and B1 being from the same sheet like 1):
=IF(A1=B1,Sheet2!B2)
edit: can't read question, only works if A1 and B1 are on same sheet
If I am not misunderstanding your wish, there is the code below. Please insert it into cell C2 in Sheet1
=IF(A1=B1, Sheet2!B2, "")
But you did not provide what sheet of cell B1 in pharse
I want cell C2 in sheet 1 to display what is in cell B2 from sheet 2 IF cell A1 in sheet 1 is the same as cell B1
So, I assumed that it is the same as A1 that is Sheet1. If you want to compare with the cell B2 in another sheet please Insert Sheet2: before B1.

Resources