I am trying to perform a text replacement over multiple cells. I'm sure I can do this using ARRAYFORMULA, but I'm not sure how to feed SUBSTITUTE with an array rather than a single value.
I have tried using =ARRAYFORMULA(SUBSTITUTE(A1:A, '&', '&')) but this gives a formula parse error.
What is the correct formula to use?
You need to use the double quotation marks " instead of the single quotation marks '
=ARRAYFORMULA(SUBSTITUTE(A1:A, "&", "&"))
Related
I'm trying to use regex to extract information from a large text file on google sheets, but within the regex, I'm using quotation marks, and instead of treating everything like the text I want to use, the quotation marks make it so that the regex splits into many different parts. Is there some character I can add to prevent this?
As an example, say I used =REGEXEXTRACT("name"="",""name"="(\w+)"")
It would basically split this into:
REGEXEXTRACT(
"name"
=
""
,
""
name
"="
(\w+)
"")
and would return a formula parse error.
Is there any way I can cancel out certain quotation marks?
Solution:
You can escape double quotes by... another double quote!
So if your first formula argument is name"=" and your second formula argument is "name"="(\w+)", you would use:
=REGEXEXTRACT("name""=""","""name""=""(\w+)""")
Output: (note that I used concatenate to show the expressions)
I am trying to build a URL in a cell (google sheets) which will get some of its values from different cells. I have tried using all different ways I can think of like concatenate, Join, & etc but the problem is that the URL has some curly brackets and " as a requirement and that breaks the formula:
URL Example
https://katang.io/?t_pid=1&t_extra={"Source":"stackoverflow","Type":"email","Stategy":"banner"}
So I need "Source":"stackoverflow" to be dynamic
so for example "Source":"Get Value from Cell A1"
Any Help or guidance will be much appreciated
Things to note:
"" makes a literal " character in a string, so you'll have to double up every one.
The & is the concatenation operator in a formula, so you can use that to get values outside of your string.
Therefore, this formula should work:
="https://katang.io/?t_pid=1&t_extra={""Source"":"""&A1&""",""Type"":""email"",""Stategy"":""banner""}"
This is the example sheet.
Alright, in cell V1!A1 is the formula ={"Languages";ARRAYFORMULA(TRANSPOSE(QUERY(TRANSPOSE(B2:F&","),,COLUMNS(B2:F))))}. I need to combine data from B2:F with the delimiter ,. But now I need to delete the unnecessary delimiters.
In sheet V2, I tried ={"Languages";ARRAYFORMULA(REGEXREPLACE(REGEXREPLACE(TRANSPOSE(QUERY(TRANSPOSE(B2:F&","),,COLUMNS(B2:F))),"(^(,(\s,){4})$)|(^(,\s)+)|(,(\s,)?\s?$)",""),"(,\s,)+\s?",", "))} but it's not consistant and still leaves delimiters in the output.
Is there a better way to do this?
I added a sheet called "Erik Help" which replaces your formula with the following:
=ARRAYFORMULA({"Languages";SUBSTITUTE(TRIM(TRANSPOSE(QUERY(TRANSPOSE(B2:F&" "),,COLUMNS(B2:F))))," ",", ")})
Essentially, instead of appending a comma to elements of the range B2:F, I appended a space. Then I applied TRIM to the results, which will leave no spaces before or after each concatenation and only one between each element. To that, I applied a SUBSTITUTE of the single spaces with a comma-space.
I'm experiencing an error when I try to add a (") quotation mark in between 2 other quotation marks using a formula in google sheets, see below.
This is what I'm trying to achieve: "Example1" using this formula.="""&A2&"""where A2 = Example 1
If I use commas in between the quotation marks, it works. How can I make this work with the quotation marks?
you need 4 of them:
=""""&A&""""
also you can use CHAR(34)
=CHAR(34)&A2&CHAR(34)
Unfortunately the data I'm working with requires quotation marks, as it is entered into another system afterwards which requires it.
I'm trying to collect statistics, and need to count these entries. The only thing they have in common is they are wrapped in quotation marks.
I'm trying to use =COUNTIF($C3:$C, """) but it keeps changing it to =COUNTIF($C3:$C, "")"").
Is there a way to escape this so that i can count cells that contain a quotation mark (")?
Like Robin said, the most straightforward way to reference quotes is with the character code - for the double quote character it's CHAR(34). One possible solution to this uses QUERY(), like so:
=QUERY($C3:$C, "Select count(C) where C contains '" & CHAR(34) & "' label count(C) ''", 0)
You can omit the label count(C) '' at the end if you're okay with it displaying a header cell, but adding it on contains the entire result to a single cell.
Try this it seems to do what you want to do:
=COUNTIF(C3:C, "'*")
note the single quote mark.