Autofill Google Sheet rows with a formula - google-sheets

I need to combine multiple cells in Google Sheets and have it autofill as new rows are populated. I tried using the ARRAYFORMULA, however it does not update the new cell reference. It only copy/pastes the first row formula and applies to the rest of the rows. Please see attached image for reference.
So I need to combine columns B, C & D in column A, while the formula in column A should dynamically reference the new row. Here's the formula used:
=ARRAYFORMULA(IF(ISBLANK(B:B),"",IF (B:B <> "",concatenate(text(B1,"yyyy-mm-dd") & C1 & D1 & E1),"COMBO")))
In the formula above, is there a way for values B1, C1, D1 to dynamically update to C2,D2, etc,...?
Thanks!

Just like mentioned in the comments, you can use FILTER and use this formula
=FILTER(TEXT(B:B,"yyyy-mm-dd") & "" & C:C & "" & D:D & "" & E:E,B:B<>"")
Furthermore, you can read more about the FILTER function by checking this link:
FILTER Google Sheets;

previous answer can be simplified to just:
=FILTER(TEXT(B:B, "yyyy-mm-dd")&C:C&D:D&E:E, B:B<>"")
otherwise, if you want to use your formula:
=ARRAYFORMULA(IF(B1:B="",,TEXT(B1:B, "yyyy-mm-dd")&C1&D1&E1, "COMBO")))
or:
=ARRAYFORMULA(IF(B1:B="",,TEXT(B1, "yyyy-mm-dd")&C1:C&D1:D&E1:E, "COMBO")))
or:
=ARRAYFORMULA(IF(B1:B="",,TEXT(B1:B, "yyyy-mm-dd")&C1:C&D1:D&E1:E, "COMBO")))
or:
=ARRAYFORMULA(IF(B1:B="",,TEXT(B1, "yyyy-mm-dd")&C1&D1&E1, "COMBO")))

Related

ARRAYFORMULA is only populating the first row

I have financial data that I am trying to summarize in a format that can be used by a line chart.
The example spreadsheet is here.
In my source data on the left, I have an entry per Date, Symbol, Account. I need to transform this data so there is a row per Date and a column for each Symbol. I will SUM Total Value regardless of account.
I found a way to pull a unique Date (see H2), and then transpose unique Symbols into columns (see I1).
I also found a way to use SUMIFS to get the aggregation I want (take a look at cell I2), but I can't figure out how to use ARRAYFORMULA to apply this value to all rows in column I.
I know I can drag my formula from I2 down to I3,I4,I.. etc, but this sheet is part of a larger project so I'd like it to auto-populate as dates are added to H.
From what I've read ARRAYFORMULA should apply the formula to multiple rows. What am I missing?
Thanks
use:
=QUERY(A1:F, "select A,sum(F) where A is not null group by A pivot B", 1)
Use formulas like this
=ARRAYFORMULA(IF(H2:H="",,SUMIFS($F$2:$F, $A$2:$A, $H2, $B$2:$B, I$1)))
Add IF(H2:H="",,
Explanation
if the range is empty "" do nothing ,, else Your formula
Your Example
Cells
Formulas
I2
=ARRAYFORMULA(IF(H2:H="",,SUMIFS($F$2:$F, $A$2:$A, $H2:H, $B$2:$B, I$1)))
J2
=ARRAYFORMULA(IF(H2:H="",,SUMIFS($F$2:$F, $A$2:$A, $H2:H, $B$2:$B, J$1)))
K2
=ARRAYFORMULA(IF(H2:H="",,SUMIFS($F$2:$F, $A$2:$A, $H2:H, $B$2:$B, K$1)))

Google Sheets Add Formula Automatically After New Row

I'm using Zapier to automatically send data to a google sheet and I'm looking for a solution that allows me to automatically add the formula I want in a column when a new row is added.
For example: In column K I'm using this formula:
=VLOOKUP(J2,'List of Employees'!A:B,2,false)
This VLOOKUP function is working properly but only if I double click and expand the formula.
How I can automate this and pass the formula to the next new row created by Zapier?
Clear column K and then enter in K2
=ARRAYFORMULA(IF(LEN(J2:J), VLOOKUP(J2:J,'List of Employees'!A:B,2,false),))
This formula should not be dragged down as it processes all contents of column J and create an output in column K.
I hope that helps?

How can I rewrite the Google Sheet formula to make it autofill without hand dragging?

I have only given data A & B 2 columns and want to create column C to concatenate column A & B with autofill function. How can I rewrite the C1 formula to make it?
Any thoughts? thank you
try:
={"PK"; ARRAYFORMULA(TEXT(B2:B, "yyyy-m-dd")&A2:A)}
or just:
={"PK"; ARRAYFORMULA(B2:B&A2:A)}

How to create arrayformula sequence number separated by comma in google sheets

How to create arrayformula sequence number separated by comma in google spreadsheets
expected results is in column B
A
B
5
1,2,3,4,5
2
1,2
3
1,2,3
How about the following sample formula?
Sample formula:
=JOIN(",",ARRAYFORMULA(ROW(INDIRECT("A1:A"&A1))))
When you use this formula, please put this to a cell "B1" and drag down it.
The flow of this formula is as follows.
Create a1Notation of cells using "A1:A"&A1 using INDIRECT.
Retrieve row numbers from the a1Notation using ROW.
Join the row numbers with , using JOIN.
Result:
Note:
When you want to put all result values using one formula, unfortunately, I couldn't find the formula using the built-in functions. In that case, I would like to propose to a custom function as follows. When you use this, please copy and paste the following script to the script editor of Spreadsheet.
And, please put a formula of =SAMPLE(A1:A) to a cell "B1". By this, the result values are put to the column "B" using the values of column "A".
const SAMPLE = v => v.map(([e]) => e && !isNaN(e) ? [...Array(e)].map((_, i) => i + 1).join(",") : "");
References:
INDIRECT
ROW
JOIN
Custom Functions in Google Sheets
You can use TEXTJOIN() with SEQUENCE() function.
=TEXTJOIN(",",TRUE,SEQUENCE(A1))
You can also use this functions in desktop Excel365

Google Sheets Arrayformula a Query

I originally have this formula:
=QUERY('Sheet1'!$C$6:$I, "Select F where D contains '"&$B86&"'")
This is applied to every cell from $B86 down to $B145. Users of the sheet accidentally deletes formula and adding protection isn't an option. So I'm thinking of adding the formula to the header only using arrayformula. However, arrayformula can't be used for query.
QUESTION 1:
Is there any other way around to get the same result when only the header has the formula?
={"Messages Sent";ARRAYFORMULA(QUERY('Sheet1'!$C$6:$I, "Select F where D contains '"&B86:B145&"'"))}
This is kinda what I want to achieve. However, this doesn't fill the data from B87 to B145. I only get the header and result for 1 row below the header.
Explanation
This shows the header ={"Messages Sent";
This is supposed to be the arrayformula ARRAYFORMULA(QUERY('Sheet1'!$C$6:$I, "Select F where D contains '"&B86:B145&"'"))}
This is the data from another sheet 'Sheet1'!$C$6:$I
This is the same data from the current sheet to find F in sheet 1 '"&B86:B145&"'
QUESTION 2: HOW CAN I GET THE ANSWER FROM THE QUERY AUTOMATICALLY SET INTO A NUMBER FORMAT SO I CAN DIRECTLY ADD THEM INSTEAD OF FORMATTING THEM MANUALLY AS NUMBER?
try maybe:
={"Messages Sent"; ARRAYFORMULA(IFNA(VLOOKUP(B86:B145,
{REGEXEXTRACT(""&Sheet1!D6:D, TEXTJOIN("|", 1, B86:B145)), Sheet1!F6:F*1}, 2, 0)))}

Resources