So I have a cell where I'll be putting strings, but sometimes that cell will be empty, when it is I'd like to insert a "+" to indicate that the cell needs a string.
How would I go about this?
I tried referencing itself but that was dumb after thinking about it.
=IF(ARRAYFORMULA(ISBLANK(MergedCells1)) "+",)
https://docs.google.com/spreadsheets/d/1bQnGvZw7sTZ5cY1H78bywjqhOs3ceB2bpjuLsCpKklo/edit?usp=sharing
tryin A1:
=IFERROR({""; IF(A2="", "+", IF(A2="+", "+", ))})
then hide row 1
Related
I need some help on this. I would like to find two different partial strings in a cell using a formula.
For example - if cell (A1) contains "Staples A-12345 Georgia, USA" or other cell may contain only "g345" or "g100, g000" or other times it contains both A-12345 g345 in a cell as an example.
My goal is to return a value of "GXXX" or if not present, use the "A-XXXXX".
Search A1 cell for partial text of "A-" or "G". (The "A-, must contain 7 characters" and "G, must contain 4 characters.)
If true, C1 to return value of GXXX or if that is not present, use the other one.
If it contains multiple codes (GXXX, GXXX) then return both values separated with a comma
If it contains both "A-" and "G" in a cell, grab only the "G" code.
If cell blank, return blank value.
If cell value does not contain both "GXXX" or "A-XXXXX", copy and return the same value.
I am currently using this formula. I am unable to display the actual string.
=IFS(
ISNUMBER(SEARCH("*A-*",A1)),"TRUE",
ISNUMBER(SEARCH("*G*",A1)),"TRUE")
I got confused and stuck on this.Your time and help is greatly appreciated. Thank you.
use:
=IFNA(IF(A1="",,
IF(REGEXMATCH(A1, "(g\d{3}).*(g\d{3})|(g\d{3})"), TEXTJOIN(", ", 1,
REGEXEXTRACT(A1, "(g\d{3}).*(g\d{3})|(g\d{3})")), REGEXEXTRACT(A1, "A-\d{5}"))), A1)
I have some text on row A, and I want to write on cell E1 to filter whenever I put this formula
=Filter(A1:A10;ArrayFormula(E1 REGEXMATCH(A1:A10;E1)))
but I want it to CONTAINS not EXACT text
=filter(A1:A10;REGEXMATCH(A1:A10;"(i?) TEX"))
This works but I want to add a cell value
so somehow to combine this to together
I'm trying to put value in cell E1 (?i)TEX and it finds TEXT on A row, but I want to put (?i) in the formula but can't find how to do it.
I tried
=Filter(A1:A10;ArrayFormula(E1 REGEXMATCH(A1:A10;"(i?) +"E1"")))
doesn't work
=Filter(A1:A10;ArrayFormula(E1 REGEXMATCH(A1:A10;"(i?)"+E1)))
doesn't work
=filter(A1:A10;REGEXMATCH(A1:A10;"(i?)&" "&E1"))
doesn't work
I really don't have an idea of how to add (i?) to cell value
To make a match case-insensitive you'll need (?i) instead of (i?). I believe this should work
=filter(A1:A10;REGEXMATCH(A1:A10; "(?i)"&E1))
I would like to copy a certain string (out of a longer range of strings in one cell) and show it in a different cell with Google Sheets. This is what is in the initial cell A1:A :
"String 1","String 2","String 3"
In B1:B I'd like ONLY String 3, so without the "" and the other strings.
Is this possible with spreadsheets?
Or is there any other way of doing so?
Update
So the task is to get word inside double quotes. And the mathcing string is placed in the end of text.
You may use regular expressions to deal with that, the basic formula is:
=REGEXEXTRACT(A1,"([^""]+)""$")
This will give a word inside "" from text in cell A1 at the end of text.
For example:
some text...,"Thisthat","https://www.url.com/de/Thisthat"
gives https://www.url.com/de/Thisthat
You may also use arrayformula:
=ArrayFormula(REGEXEXTRACT(A1:A3,"([^""]+)""$"))
Please, read more about this functions here and here.
Old answer
if you want strings to be on their rows, use this formula in B1:
=ArrayFormula(if(A1:A = "String 3";A1:A;""))
If you have cells in A1:A, which contain 'string 3', and you want to match them too, use this:
=ArrayFormula(if(REGEXMATCH(A1:A , "String 3"),"String 3",""))
I have a dataframe with 1 column called 'full_url'. Each element of the column is just a url. How to I write a function to remove the 'http://' from all of the elements at once? I need to use some kind of regex because some don't have it at all, some have https, etc. The closest I've gotten is gsub(".*//","",unlist(full_url))
but that also returns 'full_url1' 'full_url2' 'full_url3' ... as the row names for some reason
Without a reproducible example I'm not sure, but would something like this work?
apply(df$full_url, 1, function(x) ifelse(substr(x,1,7) == "http://", substr(x,8,length(x)),x)
So using apply to go by row and substr to find if the first 7 characters are "http://". If they are replace without the http and if they're not then replace with just x.
I have a column which has "--" pattern in the beginning, middle and end of the string. For example:
-- myString
my -- String
myString --
I want to find these two types of cells
-- myString
myString --
and remove the "--" pattern, so it will look fine! I am an amateur user of excel but can use functions if you suggest me. It should be possible with find and use the results of the Find in Replace functions, but I do not know how to pass the results to Replace.
Please note: The answer should take care all the cells in the column, which are hundreds. One solution for changing all, not one solution for one cell.
EDIT: Just reread the request, per instruction from Gary'sStudent. This will remove all instances of "--", not only those at the beginning/end.
If the data is in A1, use the following formula:
=SUBSTITUTE(A1,"--","")
With data in A1 in B1 enter:
=IF(LEFT(A1,2)="--",MID(A1,3,9999),IF(RIGHT(A1,2)="--",MID(A1,1,LEN(A1)-2),A1))
OK, I found the answer. The answer from #Dubison helped me to find the right answer.
If the left two characters in this cell is "--" and the last two characters are "--" the substitute the "--" with "", else to nothing.
=IF(LEFT(A1,2)="--",SUBSTITUTE(A1,"--",""),IF(RIGHT(A1,2)="--",SUBSTITUTE(A1,"--",""), A1))
This will be pretty much the same with previous answers, only using simpler logic. If your strings first or last character = "-" do nothing, else replace "--" with "".
=IF(LEFT(A1,1)="-",A1,IF(RIGHT(A1,1)="-",A1, SUBSTITUTE(A1,"--","")))
UPDATE:
I noticed that I have misread the question. Above code will remove the "--" only if it is in the middle. However original question was to remove "--" only if it is at the beginning or at the end. So formula should be:
=IF(OR(LEFT(A1,2)="--",RIGHT(A1,2)="--"),SUBSTITUTE(A1,"--",""),A1)