Detecting what row a google spreadsheet is in - google-sheets

Is there a way to make a formula that would detect what row it's in and I can copy and paste it into all instead of typing out a different formula for each one, since I have a very big spreadsheet.
I.E Divide column A, Current Row by two.

If I understood this correctly, you can have arrayformula in cell F2 that references E2:E. No need to figure out the rows... try:
=ArrayFormula(if(len(E2:E), E2:E/2,))
Note: according to your locale you may have to replace the comma's with semi colons.

Related

IF and REGEXMATCH formula excluding RR in a column but select for letters K-Z

So, I have a formula graciously shared by someone here that works amazing in highlighting cells in a column that contains letters from K to Z, excluding RR. Here it is below...
=REGEXMATCH(E5:E,"[K-Z]")*(REGEXMATCH(E5:E,"RR")=FALSE)
But, I'm trying to accomplish the same thing with an IF formula (not conditional formatting), where if a cell in column E contains a letter from K-Z, it will display the green checkbox, and if not, display the red down arrow. I'm not sure exactly how to exclude RR again in the equation. Here's the formula I'm trying to get to work...
={"OL";ARRAYFORMULA(IF(E5:E="",,if(REGEXMATCH(E5:E,"K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z"),"✅","🔻")))}
The formula works except it includes cells containing RR, I guess because R is in there? But I want to exclude cells containing RR.
Here's a Google Sheet that contains the formula I'm currently using.
Thanks for any help you can provide.
I left a new sheet ("Erik Help") with a formula in B1 that somewhat follows the form of your original formula there, since that seems to be something you understand. All I did was add another outer IF to rule out instances of "RR" up front:
={"OL";ARRAYFORMULA(IF(A2:A="",,IF(A2:A="RR","🔻",IF(REGEXMATCH(A2:A,"[K-Z]"),"✅","🔻"))))}
use:
={"OL"; INDEX(IF(
REGEXMATCH(E5:E,"[K-Z]")*(REGEXMATCH(E5:E,"RR")=FALSE),
"✅", "🔻"))}

Apply same formula to every cell

I have a sheet with several numbers, which I want to convert to percentage. These are scores imported from a form, where the maximum score is 5.
According to the bellow image, the cell B2, I applied a basic formula =(3/5)*100% to convert three to 60%.
In order to avoid copy and paste the same formula into all cells, is there any formula to find all the cells and apply its value, divide per 5 and multiple per 100%? I thought something similar to Javascript such as (this/5)*100%.
https://docs.google.com/spreadsheets/d/1ZtqJaXy1pHkjk1sywGfSodo0FcOoLlkou79cZBk-jmU/edit?usp=sharing
you could treat it as array and on Sheet2 use:
=ARRAYFORMULA(IF(Sheet1!B2:AA="";;(Sheet1!B2:AA/5)*100%))
demo sheet
I've also looked for a solution to this for some time.
I don't think it's possible as a cell can only hold one value and the moment you try to change that value, it will delete the value.
Your best bet is to create a different table on the same sheet that references the specified values, then copy and paste the results (values only).
Just create a second Sheet, then in cell B2 of Sheet2 use the formula =Sheet1!B2/5*100%.
Then copy the formula to all cells of Sheet2.

How to apply formulas in rows with unknown no of columns?

This works:
This does not:
I don't know why.
EDIT:
Thanks to Marios this works:
=ARRAYFORMULA( IF(B5:5 = "Start","",IF(
B6:6-A6:6>-1,B6:6-A6:6,0)))
"Start" to be changed to a named range with the actual date at the top of the sheet.
Explanation:
You are trying to execute this formula:
=ARRAYFORMULA(C6:6-B6:6)
in cell C7.
The issue with that is this part B6:6. This is a range of columns starting from B until the last column in your sheet, but since you put that formula in cell C7 your starting point is column C.
Essentially, you want to put the range of values from column B until the last column of the sheet but your available space is from C until the last column of the sheet and therefore you lack 1 column as the error also suggests.
An analogy would be:
fit a big box inside of a smaller one with a size difference of one column. In this case the big box is the range of B6:6 and you are trying to put it in a smaller box of a range C6:6.
Solution:
Try to put that formula on cell B7 and it will work. Don't drag it, because the big range will shift to column A and you will face the same issue. Just use the same exact formula on cell B7:
=ARRAYFORMULA(C6:6-B6:6)
While this might not be your goal, it explains what is the current issue you are facing and what to do in order to fix it.
Update based on your solution:
=ARRAYFORMULA(iferror(IF(B5:5 = "Start","",IF(B6:6-A6:6>-1,B6:6-A6:6,0)),""))
I added an iferror check to catch the first error value caused by the string.
You should use this:
=ARRAYFORMULA(IF(B5:5 = "Start","",IF(B6:6-A6:6>-1,B6:6-A6:6,0)))

How do I organize formulas to work with columns in google sheets

Hi so I'm trying to make a spreadsheet in Google Sheets that takes two numbers and subtracts them and then does it in the next row .
So example the formula in C1 would be "subtract(A1, B1)" in the first row. But then in the next row I would like it to change to "subtract(A2, B2)" and output in C2.
(Without having to go in each C cell and change the formula of course)
So how do I do that and also how do I apply a formula to multiple cells of a row (C1,C2,C3,C4,C5, etc....)
Just put =MINUS(A1,B1) into C1 and then copy it and paste it in the remain rows of column C and the spreadsheet automatically adjusts the row numbers for you.
#Cooper's Answer above is perfect. I'm just giving a alternative here using array formulas, because it's easy.
Put this in D2
=ARRAYFORMULA(MINUS ( B2:B, MULTIPLY( 2.5, QUOTIENT(C2:C,15))))

How to use arrayformula to dynamically join strings in google spreadsheet?

I use Arrayformula() to make my reports dynamic and easier to edit. For example, if I have a Column A with a list o number o blue balls in a set and a Column B with a list red balls in a set, on the cell C1 I can write =ArrayFormula(add(A1:A,B1:B)) and in the Column C will have the total of balls in each set. It would be exactly the same as writing =A1+B1 in cell C1 and dragging the formula down to the last row. Arrayformula() has some benefits, because it will work if some adds or removes rows from the sheet and also it makes the reports way more organized and easier to edit.
Since I´ve discovered arrayformula(), my life has changed, because of the fact that googleSheets expands the formula to other cells. It does not work every time, but the idea of expanding to other cells seems to be possible some way or another, here is a good example of a problem that was not resolved by arrayformula(), but has the same idea.
Keeping that idea in mind, imagine that on Column A there is a list of First Names and on Column B there is a list of Last names. On Column C I want to join this two string using a simples space. The way to do that would be in the cell C1 write =join(" ",A1,B1) and then drag down this formula. This method method however is prone to error since people can add and remove rows, deleting my formula. I want to use a formula that I can write in one single cell and it expands to other cells. I´ve tried =arrayformula(join(" ",A1:A,B1:B)), but it does not work.
Is that a way to do that using =arrayformula() or other native function?
I know I could write a script or custom formula to do that, but this is not my goal here.
I think this formula should work:
=arrayformula(A1:A&" "&B1:B)
In case you want to use a delimiter, you can do the following to have a clean result even though, A or B is not present in some cases:
ARRAYFORMULA(ifna(ifs(isblank(A1:A),,ISBLANK(B1:B),A1:A),A1:A&" - "&B1:B))

Resources