How to pull down formulas in a new Google Sheets tab? - google-sheets

I have a newly created Google Sheets tab with 1.000 rows and two formulas:
in F2: =IFERROR((VLOOKUP(B2,sv!$A:$D,2,0)/C2+IF(C2=ctr!A$2),""))
in G2: =IFNA(REGEXEXTRACT("."&A2&"/","\.([^.]+\.[^./?]+)(?:/|\?)"),"")
How can i pull this formulas down to 300.000 rows? Without to manually pull them and wait until Google Sheets scrolls the tab 300.000 rows to bottom?

select cell that holds the formula
press CTRL + SHIFT + DOWN ARROW
(and keep tapping DOWN ARROW till you reach the desired last row
press CTRL + ENTER
done
or use ArrayFormula:
=ARRAYFORMULA(IFERROR(VLOOKUP(B2:B, sv!A:D, 2, 0)/C2:C+IF(C2:C=ctr!A2, 1, 0), ))
=ARRAYFORMULA(IFNA(REGEXEXTRACT("."&A2:A&"/", "\.([^.]+\.[^./?]+)(?:/|\?)"), ))

Related

ARRAYFORMULA with a range that changes from cell to cell

I have a list of items in column A. In column B I want to use an ARRAYFORMULA function that will bring the serial number of each item to appear - 1 next to the first item, 2 next to the second etc.
This formula works fine but breaks when there are blank rows:
=ARRAYFORMULA(IF(LEN(A2:A),ROW(A2:A)-1,""))
This formula works nice but I need to drag it which I don't want to do. This is why I want it as an ARRAYFORMULA (note that I fix the range to always start from A$1 so only the range changes in size as I drag it further down).
=IF(LEN(A2),COUNTA(A$1:A2),"")
What I need is basically something that will work like the 2nd formula but with an ARRAYFORMULA.
Here's a spreadsheet to make it clearer (col A is the list, col C is function 1 and col D is function 2):
https://docs.google.com/spreadsheets/d/17qVGwvFJVrxdwkgmVQatH3Urpjl0_xB8EGqUsPVIwl8/edit?usp=sharing
In F2 I entered
=ArrayFormula(if(len(A2:A), countifs(A2:A, "<>", row(A2:A), "<="&row(A2:A)),))
See if that works for you?

How to copy every 3 rows down (2 row cell with formula and 1 blank cells) for the next formula just go for 1 cells instead of go for 3 cells

I'm trying to copy 2 rows of formula and 1 blank row to fill down my required row, but when I'm trying to do that the formula in next row jump 3 cells, I want it so the next formula I paste just the next cell
Link to sheet:
https://docs.google.com/spreadsheets/d/1VAhls2rzaAJZiiRA-Z0Q2MusfCa8v1YoD1n2NxaCwzQ/edit?usp=sharing
sorry for my very terrible way of describing my problem, because I'm rarely using English for coding Q&A
all you need is this I guess:
=ARRAYFORMULA(SUBSTITUTE(TEXT(REGEXREPLACE(TO_TEXT(TRANSPOSE(
SPLIT(TEXTJOIN( , 1, TRANSPOSE(QUERY(TRANSPOSE(QUERY(
{IF('2019'!D2:D=0, "♥", '2019'!D2:D*0.0001),
IF('2019'!G2:G=0, "♥", '2019'!G2:G*0.0001)},
"select Col1,Col2,'♦ ♠' label '♦ ♠'''")), , 500000))), " "))),
"♦|♠|♥", ""), "0.0000"), "0.0000", ""))
if you need to output real number then wrap it after ARRAYFORMULA( into VALUE()
demo spreadsheet
The automatic alteration of formulas in Sheets when moving, copy-pasting, or drag-copying is not very sophisticated. It's also not configurable.
There may be more elegant workarounds, but I think the simplest thing to do is stop relying on it. If Sheets is bad at changing your formula, try a different formula that doesn't need to be changed in that staggered way. For example, A5 and A6 could be:
=if(INDIRECT("2019!D"&ROW()+1)=0,"",INDIRECT("2019!D"&ROW()+1))
=if(INDIRECT("2019!D"&ROW() )=0,"",INDIRECT("2019!G"&ROW() ))
This works because in A5 we want to refer to sheet 2019 row 6, so we use an INDIRECT reference to A5's row number (5) plus 1 (6).
When we're in A6, we instead want 2019 D6 and G6, so there's no adding 1.
If you can read my pseudo-formulas, your example sheet seems to follow the pattern:
  if 2019!D–next row = 0, output nothing, otherwise 2019!D–next row
  if 2019!D–this row = 0, output nothing, otherwise 2019!G–this row
  <blank cell>
Using the above formulas, if you select those three cells (formula, formula, blank), then drag-copying them keeps them working the way you wanted.

Add formula to entire row of google sheets

I am using a google sheet as a database. When a row is populated (using JSON API and Integromat), I want formulas in the newly added row to update. However, I cannot get the formula to be applied to the whole column automatically.
For instance, C1 is =A1+B1. When A2 and B2 are added, C2 should be =A2+B2.
I have tried:
Double clicking the box in the bottom right corner of the selected cell. This does not work because it adds the formula for all rows that contain data. When a new row is added, the formula is not applied to that row.
Using the formula with a range =A1:A+B1:B. This formula is only applied to the selected cell.
Pasting the formula in the column header. This simply did not work. Even when I tried to include a formula that used a range =A1:A+B1:B.
Using hotkeys like shift + ctrl + Down + D. I was unable to find any that worked. Most were for windows computers (I am using a mac).
I'm sure I'm just making a stupid error, but I haven't been able to find any solutions.
Thanks in advance!
Place this in the header row (assuming the header row and you want to add all other rows).
={"YOUR HEADER";ARRAYFORMULA(A2:A+B2:B)}

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

VLookup arranged into cell based on neighbor cell

I am looking for a way to do a VLookup that will call information from Google Sheet 2 into Google Sheet 1. Specifically, if cell H in 'Google Sheet 1' matches cell A in 'Google Sheet 2', it will put the information from cell B in 'Google Sheet 2' into the corresponding row in 'Google Sheet 1'.
Example is below:
Before function:
Google Sheet 1:
H I
1 Eng#1 (Blank)
2 Eng#2 (Blank)
3 Eng#3 (Blank)
4. ENG#4 (Blank)
Google Sheet 2:
A B
1 Eng#1 .4
2 Eng#2 .1
3 Eng#4 .7
4. Eng#7 .3
5. Eng#3 .2
Result I am seeking:
Google Sheet 1:
H I
1 Eng#1 .4
2 Eng#2 .1
3 Eng#3 .2
4. Eng#4 .7
5. Eng#7 .3
I would very much appreciate assistance with this, as it would be a way to increase efficiency and tracking for a group of people.
It sounds like you need to combine VLOOKUP and IMPORTRANGE. Try something like:
=ArrayFormula(IF(H:H="",,VLOOKUP(H:H,IMPORTRANGE("SheetKey","Sheet1!AB:AC"),2,0)))
Note that it may be necessary to try the IMPORTRANGE on its own first, to ensure that the Sheets have the correct access to each other.
It sounds like you need is an IF statement which you can then drag down vertically to all of column H -
=IF(H1=Sheet2!A1,Sheet2!H2,"")
You can copy and paste it to H4,H6,H8 etc and the cell references will change for you
if you are matching H1 against any row of column A use
=VLOOKUP(H1,Sheet2!A$1:A$100,2,false)
dragging this vertically will keep it referring to cells A1:A100 in Sheet2 but it can be copied/pasted to different cells horizontaly (cell references will change for you)

Resources