I'm trying to use offset to link two sheets in a work book
I am in Sheet2
If I type ='Sheet1'!B6 .... it gives me B6 from Sheet1
If I type +OFFSET('Sheet1'!B6,0,ROW()).... it gives me L6 from Sheet1
Why does it not pick up B6?
If I drag down the second formula it gives me M6,N6,O6,P6 etc, so it's at least consistent.
I've tried everything I can think of to get it to refer to the proper cell but to no avail. It's frustrating as I could have typed the data in by now!
Try
=OFFSET('Sheet1'!B6,0,0)
The "Row()" function is returning a value that is pushing the Offset 11 columns to the right.
Your mistake is you have ROW() in place of column argument ? The 3rd argument in OFFSET is column number and not row number.
Try :
=OFFSET(Sheet1!B6,0,0)
In OFFSET, 0 Row and 0 column means it is the same co-ordinate as the current referenced cell. That is, from Sheet1!B6 increase/decrease 0 rows & 0 columns.
I Have found a solution!!
If I create another column say B in Sheet2 and fill it with 1,2,3,4 etc.I can use the formula like this:-
=OFFSET('Outside funds'!$B$6,0,(B10-1))
It picks up everything correctly.
It may not be the best solution but it works.
Thanks for your help.
To transpose columns to rows, try
=OFFSET('Sheet1'!$B$6,0,ROW()-1)
The second offset parameter is the row offset, the third is the column offset. Make sure to anchor the first parameter otherwise you'll double the offset when you copy down.
Related
The question is slightly confusing, so I will do my best to elaborate. I have a series of cells in a row with all of the cells in the row with a value of 0 and one cell having a value of 1. I want to use the COUNT function to count all of the cells to the right of the cell that contains the value of 1, including that cell. I would then use this number of counted cells in another equation. Does anyone have any suggestions on how to do this? I have tried using a lookup function inside of the count function, but it has not worked. This is my closest guess:
=COUNT(Lookup(1,A1:J1):J1)
This results in an error. Do I need to use VBA to make this work or should I be able to write an equation? I appreciate the help, or if there are any other strategies that I can use to attain the result I am looking for.
Edit: I am adding in some sample data and expected results. I am trying to count all of the cells to the right of the "1" including the cell containing the "1". So in this example, I would expect the formula to return "13" as there are 12 cells to the right of the "1"
You can use OFFSET() and MATCH():
That last "50" is a bit of a guess since I'm not sure how far to the right you want to count...
...and re-reading your question it's not clear if you only want to count values of 1 or if you also need to count other values as long as they're to the right of the first 1.
With data in A1 through J1, consider:
=10-MATCH(1,A1:J1,0)+1
In this case. 4 is the number of cells from G1 through J1, inclusive.
Assuming your range of 0 and 1 values is in row 2, starting from column B, use this formula in B3 and copy it across for as far as you need:
=IFERROR(COUNT($B2:B2)+1-MATCH(1,$B2:B2,0),0)
You could also use a formula of
=IF(A3>0,1+A3,IF(B2=1,1,0))
but that could cause issues if you have something in cell A3 itself.
You can use this formula:
=COUNTA(INDEX($A$1:$J$1,1,MATCH(1,$A$1:$J$1,0)):INDEX($A$1:$J$1,1,10))
The benefit to use this is it is not a volatile function, and it will also work for 1 appears in the last column.
You can use "COUNTIF" formula to count number of occurrences of specific number in a range of cells.
To count no of occurrences in a row.
=COUNTIF(1:1,1)
If it is in a column then
=COUNTIF(A:A,1)
Hope you are looking for a countif function.
COUNTIF(A1:A10, 1)
The above function counts the cell that has value 1 within the range A1:A10
My question is related to a question asked earlier, but as I am a new member I was not able to comment on that question.
The earlier question asked how we can dedupe a list in a workbook to create a new list of unique values on another sheet in the same workbook. The top voted solution given by #achaudhr works for me but in that I need to specify the exact cells the formula needs to reference. In the comments on that answer #Dan has mentioned that we must use OFFSET if we are referring to a dynamic range.
This is the formula I am using at the moment:
B2=INDEX($A$2:$A$20, MATCH(0, COUNTIF($B$1:B1, $A$2:$A$20), 0))
I have tried using offset with this formula but I guess I am doing something wrong because it keeps giving me #N/A as a result.
If my data was in column A (as per the above formula), I want to be able to change the ":$A$20" part of the range dynamically. The list in column A changes as per an input I put in the workbook on another sheet (let's call it Sheet 3). Hence I cannot hardcode the cells in the index formula range or else I have to change this range every time my list updates.
Based on the above layout, the cell in E2 calculates the max cell number for the list in column A on sheet 1. This number changes when the input in Sheet 3 changes.
I edited the above formula to use OFFSET to reference E2 in the following way:
B2=INDEX(OFFSET('Sheet 1'!$A$1,'Sheet 1'!$E$2,0), MATCH(0, COUNTIF($B$1:B1, OFFSET('Sheet 1'!$A$1,'Sheet 1'!$E$2,0)), 0))
This formula is returning #N/A (and I did press Ctrl + Shift + Enter so its not because of that).
I hope the group here can help me solve this. Look forward to the inputs and thanks for all your help.
Thanks,
Neha
The way to use OFFSET in a dynamic range determining formula, where it is column length that varies, is to use that value as the [height] parameter.
So, in the case of your example, the formula would look like:
B2: =IFERROR(INDEX(OFFSET($A$1,1,0,$E$2-1), MATCH(0, COUNTIF($B$1:B1, OFFSET($A$1,1,0,$E$2-1)), 0)),"")
Reference: $A$1 (could also set this at $A$2 with a 0 Row offset
Row Offset: 1 (since A1 contains the header)
Column Offset: 0
[height]: Contents of $E$2 minus 1 (since we are not including the header in the list)
[width]: left blank
Hi all,
I have this excel where by I need to find the location of the item if they are found in column B.
So In my F column, I tried to write ifelse formula which didnt work.which is
=IF(D2="NULL","NONE",C((D2))).
My idea is if D2 is not null, use the value in D column to find the location in C column. In this example, fish no 4, so it is found, my F column should show the value "C" using the value shown in D column and use it as Row no in C column
I hope you guys get the idea and help me out a newbie in excel. Thanks in advance
=vlookup($D2,$A$2:$C$6,3,0)
you can use that in column F. Place that formula in F2 and copy down.
you could technically use it in column E as well, but you would need to change the 3 to a 2.
you did not say what you wanted to do if the D value was "Null" so I am going to take a stab at the dark and wrap you lookup formula in an if statement that will deal with "Null" or empty cells
=IF(OR($D2="NULL",$D2=""),"",VLOOKUP($D2,$A$2:$C$6,3,0))
That is the alternative formula to place in F2 and copy down.
Use the formula:
=IF(D2<>"NULL",VLOOKUP(D2,A2:C6,3,FALSE),"Value is NULL")
Here is the working example:
Put formula in cell F2 and drag it down.
[edit]to pull proper location column, not just the row #[/edit]
Seems like a job for MATCH+OFFSET
Try this formula in cell F2:
=OFFSET($C$1, MATCH(E2,B:B,0)-1, 0, 1, 1)
Match is used to locate the value in the first argument (ie E2) within the range specified in 2nd argument (ie B:B). I use B:B but you could also use range B2:B30 or whatever more specific range you want. (I prefer the more generic B:B, though :) )
Third paramter "0" just indicates "Exact match".
This function will retun "#N/A" if nothing found.
OFFSET takes the result from MATCH to pick out the Location you want. The first parameter in OFFSET is the rows below (or above if negative) from the base row (in this case $C$1). the next is the column: 0 since we're in the column we want to be in. The last two are the size of the range: 1,1 is a 1x1 cell, so just 1 cell. If we did ...,2,3), that would be 2 rows high and 3 columns wide - or a 6 cell range. We're just after 1 cell here.
I've always preferred MATCH + OFFSET to other options, I just found they held up more robustly to changes in a sheet (ie new rows/columns added). So it's mostly personaly preference over VLOOKUP and INDEX. I honestly have never compared their actual performance, however, I've never had any issues with MATCH+OFFSET running slowly :)
I have this formula in Excel, in row E5:
=SUM(Banco!H$5;Banco!H$6;Banco!H$8;Banco!H$9;Banco!H$10;Banco!H$11)
I need it to change the COLUMN references instead of ROWS when I drag it down (basically behave like I was dragging it across)... For example:
=SUM(Banco!I$5;Banco!I$6;Banco!I$8;Banco!I$9;Banco!I$10;Banco!I$11)
=SUM(Banco!J$5;Banco!J$6;Banco!J$8;Banco!J$9;Banco!J$10;Banco!J$11)
=SUM(Banco!K$5;Banco!K$6;Banco!K$8;Banco!K$9;Banco!K$10;Banco!K$11)
Any clues?
Thanks a lot!
... Use the offset function.
For example - Suppose you had a formula in row 1 and you wanted to reference Banco!H5, you could do something like:
=OFFSET(Banco!$G$5,0,ROW())
Now, as you drag it down, it will offset by the number of rows down you go.
So your new formula would look as follows:
=SUM(OFFSET(Banco!$G$5,0,ROW()),OFFSET(Banco!$G$6,0,ROW()),OFFSET(Banco!$G$8,0,ROW()),OFFSET(Banco!$G$9,0,ROW()),OFFSET(Banco!$G$10,0,ROW()),OFFSET(Banco!$G$11,0,ROW()))
Again, this assumes you are pasting this formula in row 1 (I know it's ugly, but you specified specific cells, so you have to specify each one separately)
Hope this makes sense
Use a combination of the OFFSET and the COUNTA function. The OFFSET function will give the offset of COUNTA columns each time you go down a row. Make the counta function count the number of rows above the row that you're dragging the entire function into (aka each time you drag the function to an extra row, it will add 1)
In Excel, the Offset function returns a reference to a range that is offset a number of rows and columns from another range or cell.
can someone please tell me what that means?
for example in this formula:
=OFFSET($B$4,ROW()-ROW($F$4),0,1,1)
what is it doing?
The purpose of OFFSET(BASE, ROW-OFFSET, COLUMN-OFFSET, NUM-ROWS, NUM-COLUMNS) is to select the content of cells that are NUM-ROWS rows and NUM-COLUMS distant from the base cell. If the selected cells are just one, then the content of that cell will be used as result, otherwise the result will be an array that can be passed to functions as SUM.
In your example, the function is simply selecting the content of the cell B4.
That example formula is odd, because it references a cell to get the row then takes that away from the current row - this bit ROW()-ROW($F$4, which might as well be row()-4, but there you go.
Offset, works like this
A cell location to start at, how many rows away from this, cols away from the this, optional size(rows), optional size(cols).