*I hope to have a formula that can concatenate A and B columns but each texts within cells shall still sit next to each other.
Here is the sheet:
https://docs.google.com/spreadsheets/d/14OKObszKg5TiIYeSr929PmCi7WDKciQ_A4kOFTEeZdo
Try-
=JOIN(CHAR(10),INDEX(SPLIT(A3,CHAR(10))&SPLIT(B3,CHAR(10))))
Related
I want the title in Cell A1 (Example Title) to be in a row next to each entry in Cell B1 so my desired result is:
In Excel OR Google Sheets. I only see "Split Text To Columns"
There are many ways to go about this. I'll suggest one of them.
Suppose that your raw data is in Sheet1!:A2:B. Add a "Sheet2" and make sure that A:B is empty. Then place the following formula in Sheet2!A1:
=ArrayFormula(QUERY(SPLIT(FLATTEN(SPLIT(REGEXREPLACE(CHAR(10)&Sheet1!B2:B,CHAR(10),"~"&Sheet1!A2:A&"|"),"~",1,1)),"|"),"Select * WHERE Col2 Is Not Null"))
To understand how this works, you need to work from the inside out.
First, an extra line break (CHAR(10)) is added to the start of each cell in B2:B. This is to create a uniform breaking point before every entry in the Column-B cells.
That now-uniform CHAR(10) is replaced by REGEXREPLACE with a concatenation of a tilde (~), the Sheet1!A2:A data for that row and a pipe symbol (|). Thus far, all of the virtually-held data for Sheet1!B2:B will still be within its original cell space.
SPLIT now splits that new data at the tilde to create individual horizontal cells that each now contain a separate copy of the Sheet1!A2:A label, a tilde, and one of the list items from Sheet1!B2:B.
This new virtual horizontal and vertical grid is then FLATTENed into one column.
Again, SPLIT is applied to separate the Sheet1!A2:A label from each of the now-individual Sheet1!B2:B entries, resulting in two columns.
'QUERY` is applied to keep only those results which are not null in the second column (ruling out any results for blank rows in the raw data or errors in column one formed by the previous functions, particularly those caused with the assumption that your number of individual data points in each cell of Sheet1!B2:B will vary).
I've got an array formula which I've managed to put together as this:
=ARRAYFORMULA(if(row(B:B)=1,"Status",(if(D:D="","",IF(D:D<today(),CONCAT("Overdue by ",(TODAY()-D:D) & " days"),IF(D:D<TODAY()+30,CONCAT("Due in ",(TODAY()-D:D) & " days"),if(D:D>today(),"Not Due","")))))))
For some reason it expands the sheet much larger than I need it with blank cells. I only need it to a max of 500. Any ideas how I'd stop this from happening?
In extremis you might wrap your formula in ARRAY_CONSTRAIN and predefine the maximum number of rows and columns:
=array_constrain(ARRAYFORMULA(if(row(B:B)=1,"Status",(if(D:D="","",IF(D:D<today(),CONCAT("Overdue by ",(TODAY()-D:D) & " days"),IF(D:D<TODAY()+30,CONCAT("Due in ",(TODAY()-D:D) & " days"),if(D:D>today(),"Not Due",""))))))),500,1)
Late with the answer, but I've noticed that ArrayFormula starts expanding sheet only if the formula is not in the same row as the first cell you're targeting, so in your case B:B - ArrayFormula should be placed in first row, for B2:B - it should be placed in the second row.
Note: this behaviour only applies to to ArrayFormulas that store nested functions such as IF statements.
Thank you for the pointers in this thread. I had an arrayformula that started:
=arrayformula(if(A3:A="","",[do stuff()]))
The formula created 50,000 rows which slowed everything to a crawl.
I edited it to constrain the array to 996 rows thusly:
=arrayformula(if(A3:A999="","",[do stuff()]))
All was well and the sheet was fast as lightning again
You probably have that formula in more than one cell, and it seems it should only be in the first row of whichever column you want it to be in.
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))))
I understand cells can be merged with something the like the following:
=B2&", "&C2
This works great for cells in column B that are different than cells in column C.
However, if the cells are the same, I would like to output only the contents of cells in column B.
Is this doable in Excel 2010?
How about using an If formula:
=If(B2=C2,B2,B2&", "&C2)
I have a table with data in three columns, lets say from E26 to G47. What I want is to display the row-wise sum of this data in another spreadsheet, so the cell E26 of the other spreadsheet contains the sum of E26 to G26 from the first sheet. I tried to implement it in code, but I was unsuccessful:
=SUM(ImportRange("key"; "sheet!E26:G47"))
This sums the whole data of rows and columns in one cell.
=SUM(ImportRange("key"; "sheet!E26:G26"))
This does nothing.
How can I achieve this? Thanks!
One way:
=ArrayFormula(MMULT(ImportRange("key";"sheet!E26:G47");{1;1;1}))