Removing free form text from one cell to another - excel

I have 2 cells in excel and I want to remove free form text from another cell if it exists in another. For example:
Column C2 says "Great Escapes 1122 Apple St"
Column D2 says "Great Escapes"
I want a new cell to result in "1122 Apple St"

I think you can just use Substitute():
=Substitute(C2,D2,"",1)

Try what I have below. just change the formula to fit your cells.

Related

How to grab a text value from second quotation in Excel?

I would like to create a formula to grab all text within a string of text /sentence of the SECOND quotation field. For example, I have the following text"
B2: "Description":"BLUE CAR"
C2: "Description":"RED CAR"
D2: "Description":"PINK CAR"
I found a formula that can grab the second string in quotes which is:
BLUE CAR
RED CAR
PINK CAR
=MID(B2,FIND("""",B2)+1,FIND("""",B2,FIND("""",B2)+1)-FIND("""",B2)-1)
But this gives me:
Description
Description
Description
Is there a way to grab the second quotation string?
Perhaps you can try using TEXTAFTER()
• Formula used in cell C2
=SUBSTITUTE(TEXTAFTER(B2,":"),"""",)
Edit:
• Formula used in cell D2
=SUBSTITUTE(TEXTAFTER(TEXTBEFORE(B2,","),": ",2),"""",)
Using MAP()
• Formula used in cell C2
=MAP(B2:B4,LAMBDA(m,SUBSTITUTE(TEXTAFTER(TEXTBEFORE(m,","),": ",2),"""",)))
Note: Formulas will work with MS365 current channel and the last two edits are based on OP's edits.
If your value was in A1 ...
=SUBSTITUTE(SUBSTITUTE(INDEX(TEXTSPLIT(A1,":"), 1, 3), """", ""), ",", "")
... however, will depend on your version of Excel.
It also assumes that there are no additional commas in the string apart from the last one. You can fix that though if need be.
Here another one with basic approach..
=MID(A1:A3,FIND(""":""",A1:A3)+3,LEN(A1:A3)-(FIND(""":""",A1:A3)+3))

Remove values in a cell found in another cell

I am wondering if there is a formula, or several, that can remove values within a cell (not delete the cell entirely) that are defined in another cell(s).
Example:
"123 New York St Chicago IL 98765" to be "New York St Chicago IL" by using a formula that looks at the cell with the street # "123" and zip "98765" values and remove it from the cell with the full address.
Using Text to Columns is not an option at this point because there are no commas separating values, and all addresses are not in similar formats.
Any help appreciated.
I believe you're looking for Substitute(). This would need to be a helper cell, as formulas in the worksheet cannot remove/delete data.
Example:
A B
1 cat =Substitute(A$4,A1,"") 'output: The chased the dog.
2 dog =Substitute(A$4,A2,"") 'output: The cat chased the .
3
4 The cat chased the dog.
If you are looking to actually remove/delete data, you would need VBA, which isn't appropriate for Google-sheets.
in Google Sheets you can do:
=ARRAYFORMULA(TRIM(REGEXREPLACE(A1:A; "\d+"; )))
Or using Textjoin+Filterxml function, of which Textjoin available in Office365
In B1, formula copied down :
=TEXTJOIN(" ",1,INDEX(FILTERXML("<a><b>"&SUBSTITUTE(A1," ","</b><b>")&"</b></a>","//b[.!=0+.]"),0))

Lookup using multiple columns

I have a sheet filled with data below (and in the image):
Now there's this other sheet where the user will only be inputting the column "Gender" and "Age" values and the excel formula should be fetching the associated factor. Please help me with one such formula.
For e.g. If the user puts Male and 23, the formula should return 3. say Male was entered in Cell D46 and 23 was entered in E46 of Sheet named "Sheet4" and the table shown above happens to be in "Sheet1"
Please advise.
Right, now I can visualize what you meant in your other comments in your previous question, it's a rather easy redo of our other formula.
Formula in F3:
=INDEX(C1:C13,MATCH(1,(ROW(C1:C13)>=MATCH(F1,A1:A13,0))*(B1:B13=F2),0))
Entered through CtrlShiftEnter
Notice that these formulas will return a wrong result if, lets say you extend till females age of 29, and you will search for male, it will still return the value for female. It will however not fail when your searchcriteria would be always right.
You could prevent this in this case (because you only really have one criteria and a fixed range with this formula in F3:
=IFERROR(IF(F1="Male",INDEX(C2:C9,MATCH(F2,B2:B9,0)),INDEX(C10:C13,MATCH(F2,B10:B13,0))),"No result")
Just enter normally. What it does is it checks what gender type is chosen and choses it's lookup index accordingly.
Another option would be to use SUMPRODUCT() like so :
=IF(F1="Male",SUMPRODUCT((B2:B9=F2)*(C2:C9)),SUMPRODUCT((B10:B13=F2)*(C10:C13)))
Also, if you are curious what formulas do and want to learn from them, a great way to do so is using the build-in formula evaluate function, that will show you step by step what the formula will calculate.
EDIT
Tried, as per your comment, to break it down for you so you understand what is going on:
For situations like this, I've learned a good trick how to fill in the blank cells:
Select all cells in the column with the "gender" values.
Goto Special, Blanks. (You active cell should be A3)
In the formula bar, type =A2. (I believe that A2 contains the word "Male")
Press Ctrl+ENTER (don't forget the Control key for filling all selected cells)
As a result, A3 will be copied from A2 and contain the word "Male", A4 will be copied from A3 and will now also contain the word "Male", ...
Further: this stops at the first occurence of the word "Female" (this cell is not selected), and for the later cells, the copying happens in the same way as before.
From here, it should be far easier to achieve your goal.

Is it possible to subtract the content of one cell from another in excel using formula?

Is it possible in excel using any formula to subtract (or whatever appropriate terms we can call it) from one cell to another so that the third cell will contain the rest of the portion.
For example, If Range("A1") contains "I am not sure" and Range("B1") contains "not sure" and as a result the Range("C1") will have "I am" when subtraction is performed.
Original data are like:
ColumnA ColumnB
I am not sure not sure
The sky is blue is blue
Applying any excel formula, after subtracting Range("B") from Range("A"), The Range("C") will contain the rest of the portion like below:
ColumnA ColumnB ColumnC
I am not sure not sure I am
The sky is blue is blue The sky
Use the Substitute function, and Trim to remove leading/trailing spaces
=TRIM(SUBSTITUTE(A1,B1,""))
You could potentially do it this way:

MS Excel: Search, Find and Extract Specific Text Cell containing text string

Although, I've seen relatively similar or close postings
Using MS Excel MS Excel 2010, I would like to be able to search Cell Range (Column A1:A25), to find if specific text within Cell String (Column C2) is a match in Cell Range (A1:A26) and then Output the corresponding matching Keyword results found in same or adjacent cell. If matching text is not found then display "No Match Found"
Although the sample formula shown below that I'm using does work, but only indicates it found or did not find word within Cell Range I need for it to return the actual matching Keyword text found versus "FOUND" OR "NOT FOUND".
=IF(SUM(IFERROR(FIND(A1:A26,C2),0))>0, "FOUND", "NOT FOUND")
Example:
Cell String contains the following text in Cell C2:
"I found a lost German Sheppard in my backyard on yesterday"
Keyword Search Words: Column A1:A26
TYPES OF DOGS
Affenpinscher
Afghan Hound
Airedale Terrier
Akita
Alaskan Malamute
American Foxhound
American Staffordshire Terrier
American Water Spaniel
Anatolian Shepherd
French Bulldog
German Pinscher
German Shepherd
German Shorthaired Pointer
German Wirehaired Pointer
Giant Schnauzer
Glen of Imaal Terrier
Golden Retriever
Gordon Setter
Great Dane
Greater Swiss Mountain
Great Pyrenees
Greyhound
Harrier
Irish Setter
Irish Terrier
The Returned and displayed results/answer = German Sheppard
Please let me know if this possible, as I would greatly appreciate any assistance to resolving my question.
Miaka3
Assuming you are searching column A for a string(s) in column C type this array formula in B:
=IFERROR(INDEX($C$2:$C$6,MAX(IF(ISERROR(FIND($C$2:$C$6,A2)),-1,1)*(ROW($C$2:$C$6)-ROW($C$2)+1))), "None")
You can see here that I have a search list of multiple characters/strings in C2 through C6. If one of the search strings is found, it will be listed in column B, otherwise it will display "None".
The key to this working is copy the above formula into cel B2 and while you are still in edit mode pressing Ctrl+Shift+Enter instead of just Enter like usual. You will know it works correctly if you see the addition of { and } in the formula once you hit the three key combination. After that you can copy the formula down through A25 or wherever you need.
Note you can make your Search List longer or shorter as needed, just make sure to update your formula to reflect the range. You will want to fill in all of you dog breeds in Column C and change every $C$2:$C$6 in the formula to equal your search list range. And, remember, any change to the array formula requires Ctrl+Shift+Enter to work properly.
This isn't what Excel was designed for, but you can accomplish it with a helper column. Insert a new column at B (this will move C2 to D2). Then paste this formula into B2:
=IF(ISERROR(FIND(A2,D$2)),"",A2)
Fill down that formula until A27 (you said A26, but your example went to A27 if you include the header "TYPE OF DOGS"). This will output the breed of the dog only if it is contained within the text in D2.
Finally, go to whatever cell you would like to contain your output, and paste in:
=CONCATENATE(B2,B3,B4,B5,B6,B7,B8,B9,B10,B11,B12,B13,B14,B15,B16,B17,B18,B19,B20,B21,B22,B23,B24,B25,B26,B27)

Resources