Referencing the row below the current one in OpenOffice / LibreOffice Calc - reference

In OpenOffice Calc / LibreOffice Calc, I need to find out if a cell in the row below the current cell is empty. To do this, I use the ISBLANK() function.
For example,
ISBLANK(B5)
That works well, but I need the function to be generic to always look at the row below the current row. For example in row 4, I need to be looking at cell B5, and in row 5, I need to be looking at cell B6.
In pseudo-code, this is: ISBLANK(B[row below the current one])
For reasons beyond the scope of this question, I can't just extend the formula to autofill the correct rows.
Can this be done in OpenOffice or LibreOffice? If so, how?

=ISBLANK(INDIRECT(ADDRESS(ROW() + 1,COLUMN())))
ROW() + 1 gives the row number below the current row.
COLUMN() gives the current column.
ADDRESS() followed by INDIRECT() gets the actual cell of that row and column.
Or this, which is closer to your pseudocode:
=ISBLANK(INDIRECT("B" & ROW()+1))

Related

Incrementing excel formula by two

I have an excel sheet with the following formula:
=('Forecast Workings'!T2+'Forecast Workings'!T3)/1000-4.6
=('Forecast Workings'!T4+'Forecast Workings'!T5)/1000-4.6
=('Forecast Workings'!T6+'Forecast Workings'!T7)/1000-4.6
How can I write this formula so that I can simply drag this down to fill in the rest of the values and that I get the value to increment by 2 each time?
If your initial cell is in first row and you want to multiply you could use:
=(INDIRECT("Forecast Workings!T"&ROW()*2)+INDIRECT("Forecast Workings!T"&ROW()*2+1))/1000-4.6
Subtract value from ROW() if you are not in the first row.
try,
=sum(index('Forecast Workings'!T:T, (row(1:1)-1)*2+2),
index('Forecast Workings'!T:T, (row(1:1)-1)*2+3))/1000-4.6
You will need a helper column, or use indirect and then use a mathematical approach on the formula row() to get the right return. as an example if you start this in row 2 and drag down this will increment by two. (assuming row one are titles)
=INDIRECT("'Forecast Workings'!T" & (ROW()-1)*2)+INDIRECT("'Forecast Workings'!T" & ((ROW()-1)*2)+1)/1000-4.6
I would also advise to check out the code of conduct, you would need to show what you have tried to solve this yourself and what did not work.

Excel How can I direct columns by their headline?

Currently I have a huge formula in my excel sheet:
=SUM(SUMIF(INDIRECT(A9&"!$F:$F"),"working";INDIRECT(A9&"!$B:$B"))+SUMIF(INDIRECT(A9&"!$F:$F");"Open";INDIRECT(A9&"!$B:$B"))+SUMIF(INDIRECT(A9&"!$F:$F");"internal",INDIRECT(A9&"!$B:$B"))+(SUMIF(INDIRECT(A9&"!$F:$F"),"finished";INDIRECT(A9&"!$AP:$AP"))))
In A9 is the name of the excel sheet that the formula has to use. So for example in A3 there's '20140612', so it has to use the excel sheet with the name '20140612'. Furthermore it sums up some values depending on some conditions.
My question is: I would like to direct the columns in the other sheets by their headlines, not their positions in the sheet. So for example le column AP doesn't always has to be in the position AP, but has always the headline 'Points'.
Can you think of an adaption of the formula that can direct the column by their headline?
I though of the MATCH formula. But I'm not to sure where I have to put this in.
I think the simplest answer would be to use named ranges within your sheet. In this way you could name a range (currently in column AP) as 'Points', change your formula to use 'Points' instead of '$AP:$AP' & if you move your points data about the formulas would be unchanged.
If you are planning to keep changing your header row values then you could use HLOOKUP to match up the header column probably in conjunction with MATCH & INDEX.
To answer your question about the usage of MATCH(), it's worth thinking of it as half of a VLOOKUP() or HLOOKUP(), i.e. it's the bit that finds the row or column containing the value you're searching for, then you can use INDEX() to get that row / column from a range you specify.
So, if you know that one of your column headings is "Points", then you could find it by using:
=MATCH("Points", A1:Z1, FALSE)
...which would return 10 if "Points" were the heading of column J for example. If you wanted to then use that column for a lookup, you can use OFFSET() to define that column as a range to use for a lookup, so let's say I wanted to find the text "foo" in the "Points" column, I could use:
=MATCH("foo", OFFSET(A1:Z1000, 0, MATCH("Points", A1:Z1, FALSE) - 1, 1000, 1), false)
... which uses the column index I found before as an input to OFFSET() in order to dynamically reference J1:J1000 and then search for "foo" in that column.
For your example in the question, rather than A1:Z1000 you could use a call to INDIRECT() that would return the entire range of interest from your source sheet.

Excel Row() and Column() Function

I have a simple question:
How do I reference a row combined with a column or vice versa?
e.g.
I have a table like this:
|A|B|C|D|
1 |1|0|1|
2 |4|4|2|
3 |7|2|3|
4 |5|7|2|
5 |3|9|1|
To reference A1, how do I reference it using the Row() function
I want the column to remain a constant but the row be varaible according to which row I am on.
If I am on D5, for instance, I want something like: =SUM(ARow(), CRow()) which is equivalent to =SUM(A5, C5) which returns 4.
Thanks.
... Sorry For the previous answer, given you want to change row but keep column constant, you could use the $ reference in the formula.
For example, if your formula in D5 was:
= Sum($A5, $C5)
That would keep the column constant and the row would change.
Similarly, $A$5 would force the formula to ALWAYS use A5 and A$5 would force the formula to always use row 5, but change the column.
Hope this helps :)
the ROW() and COLUMN() function reference rows and columns, not single cells...
You might be helped with the ADDRESS() function, where you can use row and column numbers as parameters.
And to the basics to reference a column-row combination without explaining further on the logic of your function you could simply use the cell address itself:
D5 : =SUM(A5, C5)

Drag down formula and change COLUMN references instead of ROWS

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)

Cell Referencing Formula

Was using this formula SheetName!CellAddress
I need to import Data that is available on other 2 sheets namely (sheet2 and sheet3) into sheet 1 in a way such that
the row values will be alternate i.e one value from sheet 2 and other value from sheet 3 respectively
Have tried like this
=Sheet2!C2
=Sheet3!D2
when i dragged for other values i was get only values in the even cell like(c4,d4,c6,d6)
If i change the for formula to
=Sheet2!C1
=Sheet3!D1
i was get only values in the even cell like(c3,d3,c5,d5)
But what i need is continous cells in row( c1,d1,c2,d2,c3,d3...)
So what formula i need to use for getting this result
I am still not 100% clear on what the question is asking, so let me know if the below answer doesn't work for you.
It sounds like what you're looking for can be accomplished with OFFSET and clever use of IF statement.
Suppose your formulas will be in column A, starting in A2. Then enter the following formula into A2 (line split added for readability; remove it):
= IF(MOD(COUNTA(A$1:A1),2)=0, OFFSET(Sheet2!$C$1, COUNTA(A$1:A1) / 2, 0),
OFFSET(Sheet3!$D$1, COUNTA(A$1:A1) / 2, 0))
Then drag the formula down.
What it does:
MOD(COUNTA(A$1:A1),2)=0 - checks whether we're in odd row or even row.
COUNTA(A$1:A1)/ 2 - takes half of the number of non-empty cells immediately above the current cell.
OFFSET(Sheet2!$C$1, COUNTA(A$1:A1) / 2, 0) - takes the cell which is COUNTA(A$1:A1)/ 2 cells below Sheet2!$C$1.
Here's a fairly basic method:
Enter the first two formulas as Text - you can either do this by formatting the cell number as text or preceding the formula by an apostrophe.
Select cells and fill down to get:
=Sheet2!C2
=Sheet3!D2
=Sheet2!C3
=Sheet3!D3
=Sheet2!C4
=Sheet3!D4
...
Select the column and choose Data|Text to Columns|Finish to change text to values.

Resources