I want to calculate the quotient of the cells in E and D rows, the logic is if both cells contains valid values then calculate otherwise do not do anything.
So far this is my formula:
={"OR (Open Rate)";ARRAYFORMULA(IFERROR(E2:E/D2:D))}
This works fine as it doesn't add value to the cell. But when I use the getLastRow() function on script editor, I get almost the 1000th cell on my empty sheet.
I suspect that the formula I am using is inserting a space or falsey values on each cell. How can I leave the cell blank if it doesn't meet my logic expression?
={"OR (Open Rate)";ARRAYFORMULA(IFERROR(E2:INDEX(E2:E,COUNTA(E2:E))/D2:INDEX(D2:D,COUNTA(E2:E))))}
Related
I would like to have a script that runs upon change in values to the sheet. What I have setup on my sheet is a few cells in a column that can have dynamic values typed into one of them (ex. J6:J10). I would like the script to run and check for a dynamic value in one of the cells, which it would then use that value in a formula contained in a different cell (I6) to calculate a formula similar to this: =ROUND(J6/E6,2). Cell J6 being dynamic.
I need the formula to be dynamic to match whichever J cell row has data and correlate to the E cell row
I was only able to get the sheet setup with its basic layout. I am still missing a working script that functions with the proper dynamic formula
If only 1 of the cells in J6:J10 has the value which you want to work with you could use in I6:
=ROUND(SUM(J6:J10)/E6,2)
What about this? It calculates all the ratios, and FILTER if J is empty; and finds the minimum ratio with MIN:
=IFNA(MIN(FILTER(INDEX(J6:10/E6:E10),J6:J10<>"")))
I go to the community to find out if there is a solution to my problem which I detail below, I have a data matrix which grows from cell to cell along rows, there are rows that have more data than others and through the formula that I will leave at the end I can obtain the last 3 values of each row up to that point the formulas fulfill their function but when I try to add the Arrayformula I cannot make the formulas work so that they are completed automatically, I would appreciate if you could help me with this problem.
Google Sheet
Here is a possible solution, assuming there are no blank cells between the non-blank cells:
=ArrayFormula(vlookup(
row(C2:C11),
{row(C2:C11),C2:I11},
mod(sequence(rows(C2:C11),3,0),3)+mmult(if(C2:I11<>"",1,0),sequence(COLUMNS(C2:I11),1,1,0))-1,
0))
I am using a google sheet in which a new row is added by inserting Col A thru a third party app. Once Col A is added I wish to copy the formula from the remaining row cells above to auto calculate the values using the formulas in that row.
ArrayFormula doesn't help as I don't want to have the rows created in advance before Col A is populated.
Any script which can do this?
What you are looking for can be achieved with a formula. I have created a quick sheet to demonstrate this.
Cell B1 contains the following formula:
={"Formula";ifna(arrayformula(filter(A2:A, A2:A<>"")*5))}
This formula defines the header (meaning that it is placed in the first row, ultimately not affecting any third party data inputs), and then uses an array formula for the rest of the column. This formula works because of the filter. That filters out any cells that are not blank and multiplies them by 5. The IFNA portion ensures that if there is no data at all, the second row is still left completely blank. This was verified with a script I wrote to simulate a data entry.
function test() {
SpreadsheetApp.getActive().getActiveSheet().appendRow([Math.random()]);
}
This script is simple, and uses the appendRow() method to simulate what a third party entry would do. I used this script, and the result is displayed in the screenshot above. This shows that an appended row will still populate the next blank row, despite there being an array formula in cell B1. Using this logic, it is possible to change the formula to populate the actual data that you need.
I need to get the sheet name from a cell.
On image below I'm trying to get '4/2'!$AB60.
need to get the date which is 4/2 (cell D5)
combine it with !$AB60
now the cell D6 will have a formula value of '4/2'!$AB60
it will display the value.
Is there a way to formulate this instead of what I currently be doing, manually updating the each column dates (from C6 to AF6)? Is this even possible?
Formula from the screenshot: =JOIN(,LEFT(D5,LEN(D5),!$AB60)
The problem with this formula is !$AB60 as it is not a valid value, instead use "!$AB60" or use =TO_TEXT(D5)&"!$AB60". To use the result of this formula as a cell reference use INDIRECT, i.e.:
=INDIRECT(TO_TEXT(D5)&"!$AB60")
I'm trying to convert excel formula to mysql syntax. I can't understand what is the function of this formula:
=IF(G1="ALL",SUMPRODUCT((Data!I:I>=Dashboard!C4)*(Data!I:I<=Dashboard!C5)*(Data!P:P="ON-TIME")*(Data!B:B<>"")/
COUNTIF(Data!B:B,Data!B:B&"")),
SUMPRODUCT((Data!D:D=G1)*(Data!I:I>=Dashboard!C4)*(Data!I:I<=Dashboard!C5)*(Data!P:P="ON-TIME")*(Data!B:B<>"")/
COUNTIF(Data!B:B,Data!B:B&"")))
Can someone explain what is the function of this COUNTIF(Data!B:B,Data!B:B&"")?
Excel COUNTIF:
Syntax: =COUNTIF (range, criteria)
Description: COUNTIF is a function to count cells that meet a single criteria. COUNTIF can be used to count cells with dates, numbers, and text that match specific criteria. The COUNTIF function supports logical operators (>,,=) and wildcards (*,?) for partial matching.
Range is obvious, but the criteria includes two Excel hacks that can be a bit obscure:
& before a cell reference will construct a text string.
see COUNTIFS with wildcard characters (its still not 100% clear)
{range}&"" means to include empty cells as a value in the computation, because normally empty cells will be skipped automatically.
Criteria with a range will cause a spill range evaluation
Note: I can't find a good reference on this...
Visually in excel this formula will be repeated for each cell in the range
COUNTIF(Data!B:B,Data!B:B&"") is saying:
Count the values in the range Data!B:B that match this cell's value, if this cell is empty, count all the empty cells in the range.
But do this for every cell in the range as well, returning a matrix of values for each cell in the range, this is the spill range bit.
It might be easier to demonstrate it, see this example:
- Range: A1:B3
- Criteria: Count all matches of the same value in the range, for each cell
- Column E shows the results of the individual formula displayed in column D
- Column I shows the results of the individual formula displayed in column H
- D5 shows the single formula that has a spill range the size of the source range matrix
- For comparison, H5 the formula that has a spill range the size of the source range matrix
Note the results in J5, without the &"" the blank cell will not be included in the count results.
In this example we can see how you could extrapolate the formula into individual cells, meaning you would have to enter the formula multiple times, but when you try to set that formula in the first cell (D1) and use the formula drag caret drag that formula to the other cells, it will also transpose the ranges, which is not what you want, see this:
Especially when your range is large, putting a range in the criteria, creating a spill range means that we only have to define the formula once and excel will effectively transform that into individual formulas for each cell in the range.