I'm trying to use the JOIN function to concatenate all the values of a column using a space and the at-sign (" #") as a delimiter. I'm receiving a Formula Parse Error when using the following text:
=JOIN(" #",!A2:A)
The referenced column is completely empty right now. Is that what's causing it not to function? If so, is there another way I can concatenate a row with a delimiter that will function even when some of the referenced cells are empty?
If it helps here is a link to the spreadsheet. The "Buyers Pinglist" is the one I need help with.
Thanks in advance!
You could wrap the formula in an IFERROR if you don't want the #N/A to show:
= IFERROR(JOIN( " #" ," ", FILTER(B3:B, NOT(B3:B = "") )))
The formula seems to work as soon as a value is added to the 'Buyers' tab - the issue is that when the column B is completely empty then there is no data returned by the FILTER and hence nothing for the formula to JOIN
Related
Here is a screenshot of and a link to my test spreadsheet. It makes the requirements very clear:
https://docs.google.com/spreadsheets/d/1rZr2zHaSkff9SFpwpx83_4TawruotA1jhOKqW6uYDz0/edit?usp=sharing
The formula I have come up with is very close to what I need, but "linkText" is a placeholder for the value of the array item. Here is my formula:
=if(A2="","","<a href='https://samplewebsite.com/search?q=" & trim(lower(substitute(A2,",","'>linkText</a>, <a href='https://samplewebsite.com/search?q="))) & "'>linkText</a>")
try:
=index(join(","&char(10), SUBSTITUTE($B$1, "linkText", split(A3, ","))))
Drag down to column.
Result:
First using SPLIT to split the strings between comma from the column A. Then using SUBSTITUTE to find the string "linkText" from the text in B1 and replace it with the strings from the returned strings from the split function. Then joining them all together.
NOTE: Just keep the reference string in a fixed cell in your sheet. <a href='https://samplewebsite.com/search?q=linkText'>linkText</a> to be used in the formula. As seen in above screenshot it is fixed in cell B1.
Alternate Solution using ArrayFormula:
You can also use it with arrayformula so you only have to put it in the first row and no need to drag down the formula to the column, it will automatically be expanded down just make sure to clear the cells below or it will throw an error.
=arrayformula(regexreplace(substitute(transpose(query(transpose(IF(IFERROR(SPLIT(A2:A, ","))<>"", "♦<a href='https://samplewebsite.com/search?q="&SPLIT(A2:A, ",")&"'>"&SPLIT(A2:A, ",")&"</a>", )),,9^9)), "♦", char(10)), "^\s", ""))
Result:
You may also have a look in below references for more information.
References:
SUBSTITUTE
SPLIT
JOIN
Comma separated list into matched columns pairings
OK, relatively simple, but frustrating for me. I think my issue isn't with the TEXTJOIN, but in defining a non-continuous series of cells for the UNIQUE function.
In cell A1, I am using this formula:
=TEXTJOIN("
",UNIQUE(B1,E1,H1,K1,N1))
NOTE: I am trying to do this for a row, and not the entire column that the data is in.
My thought was that it would join only unique values from that series, separated by a hard return.
However, I get an error.
Image of a Google Sheet error with my formula
So, looking for a way to look at a non-continuous series of cells in a row, pull out only unique values, and TEXTJOIN them together with a hard return (new line).
Your formula should be
=textjoin(" ",true,unique({B1;E1;H1;K1;N1}))
encapsulate the cells by {}
try:
=JOIN(" "; UNIQUE({B1;E1;H1;K1;N1})
or:
=QUERY(UNIQUE({B1;E1;H1;K1;N1}),,9^9)
The following is combining the results of several cells (F:T) into one cell down several rows. How can I remove any blank spaces that result from combining the cells?
=transpose(
query(
transpose(F:T),,9^9
)
)
I know I can use the TRIM() function, but I'm not sure how to include it in the Query.
use:
=INDEX(SUBSTITUTE(TRANSPOSE(QUERY(TRANSPOSE(F:T),,9^9)), " ", ))
You already know the answer, just use trim, you will notice an array error, to resolve this you just wrap the entire thing in an arrayformula:
=arrayformula(trim(transpose( query( transpose(F:I),,9^9 ) )))
Be careful with query if the majority of your data in a particular column will ever be numbers it will delete the text.
Nearly found the answer here: First non blank cell in row as an array for the column But this formula only returns the first word of each cell.
Here's my example sheet
COLUMN M is the copied formula from the above stackoverflow answer.
The only way I can get the result I need is by duplicating the formula using '&', adding a space (" ") and TRIM() at the beginning as it adds additional spaces.
Is there any way of simplifying my formula in COLUMN N?
I added a new sheet ("Erik Help") with the following formula in M1:
=ArrayFormula({"Header of Choice";IF(A2:A="",,TRIM(TRANSPOSE(QUERY(TRANSPOSE(B2:L)," ",COLUMNS(B2:L)))))})
As I see it, this is about as concise, flexible and powerful as the formula can get. It takes advantage of a quirk in how QUERY headers are handled.
This formula can handle any number of words in a cell. Of note, it assumes (as shown in your sheet) that there will only be one string to return per row in B:L. If there will be more than one possible return per row, the formula can be easily modified to include a delineator.
shorter:
={"SHORT FX"; INDEX(IF(A1:A="",,TRIM(
IFERROR(INDEX(SPLIT(TRIM(FLATTEN(QUERY(TRANSPOSE(B2:L),,9^9))), " "),,1))&" "&
IFERROR(INDEX(SPLIT(TRIM(FLATTEN(QUERY(TRANSPOSE(B2:L),,9^9))), " "),,2))&" "&
IFERROR(INDEX(SPLIT(TRIM(FLATTEN(QUERY(TRANSPOSE(B2:L),,9^9))), " "),,3))
)))}
UPDATE:
={"SHORTEST"; INDEX(IF(A2:A="",,TRIM(FLATTEN(QUERY(TRANSPOSE(B2:L),,9^9)))))}
I'm trying to use the GETPIVOTDATA function to recreate a column from the pivot table in a new sheet.
I used the formula:
=GETPIVOTDATA("SUM of Ut", 'Pivot Table 1')
I also tried
=GETPIVOTDATA("SUM of Ut", 'Pivot Table 1'!A1)
The column I want to recreate is called 'SUM av Ut' and everything can be found here:
https://docs.google.com/spreadsheets/d/1jdbBvpgR9NnuXYW5waOqAf7utC2valQOFscmgocM3kk/edit?usp=sharing
Any help would be appreciated, thanks!
Your spreadsheet use comma as decimal separator and semicolon as argument separator.
To solve the problem, on your formula replace the comma by a semicolon