Dragging formula, pattern changes - google-sheets

How do I keep the same order when dragging the formula, I want A6 to be 3 and not 5.

Use the following formula instead of =B1
=INDEX(B$1:B$10,ROW()/2)
If you want to populate the entire column withjust a formula, then this should do the trick:
=IF(ROW()/2 = ROUND(ROW()/2,0),INDEX(B$1:B$10,ROW()/2),"name")

Related

Refer to itself in ARRAYFORMULA

I am just wondering whether it is possible to achieve what I need to achieve, but using an ARRAYFORMULA.
I have a simple setup where in column B I show the value, which is present in the last previous filled in row in column A
Here is an example.
So, the questios is: is it possible to achieve the same, but with ARRAYFORMULA(s), so that in case a new row is incerted, one does not need to drag formula to fill in the new row, but the formula would be added automatically. All my attempts ended up with the circular reference problem.
This is tradtionally done with a vlookup of row numbers into a filtered array of the values. It would look like this in row 4 of your sample sheet:
=ARRAYFORMULA(VLOOKUP(ROW(A4:A),FILTER({ROW(A4:A),A4:A},A4:A<>""),2,TRUE))

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)))

Drag down the formula of IMPORTRANGE that changes the last value into increment value

I have an IMPORTRANGE formula in Google Sheets and want to apply it in the rest of the cells below. When I drag down the formula, it stays the same:
=importrange("1jhXCPi6RUf8MD7XoYgQsH-E0x768UtVxE3XY_kBrbkE","OCT!F2")
How can I drag a formula and have it automatically increment the value (OCT!F2 should be change into OCT!F3 up to OCT!F118)?
When I drag down this formula, I want it to be like this.
=importrange("1jhXCPi6RUf8MD7XoYgQsH-E0x768UtVxE3XY_kBrbkE","OCT!F3")
You may use row formula:
"OCT!F3" = "OCT!F" & row(A3)
You may also include the range in single importrange:
"OCT!F2:F500"
Be careful: importrange formulas may slow down your sheets.

Detecting what row a google spreadsheet is in

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.

Resources