Find and replace sepecific text in Excel Cell - excel

I Have a cell A2 in Excel with:
BenQ ZOWIE XL2411P 24" LED 144Hz e-Sports
I want extract phrases and transform them.
If text contain "LED" so write "Display: LED | ". If text contain "144Hz" so write "Refresh Rate: 144Hz | ". How can I do it with one function in one cell?
Thanks

You can use nested SUBSTITUTE functions for this
eg, if your text is in A1, then use
=SUBSTITUTE(SUBSTITUTE(A1,"LED","Display: LED"),"144Hz","Refresh Rate: 144Hz")
Note that this will find the search terms imbeded within other terms. Eg if you already had ...Display: LED... in your string, this will return ...Display: Display: LED...

I'm not sure I understand what you mean by "I want extract phrases and transform them." But I would think you could do something similar to displaying the result by using the ampersand. From the examples you might be able to use
IF(ISNUMBER(SEARCH("LED",A2)),"Display: LED |")&" "&IF(ISNUMBER(SEARCH("144Hz",A2)),"Refresh Rate: 144Hz |")
Though I can't verify that will work right now.
https://www.techwalla.com/articles/how-to-create-multiple-formulas-for-the-same-space-in-excel
https://www.excel-easy.com/examples/contains-specific-text.html

Related

Retreiving specific letters from Text in Microsoft Excel

I have the column as you can see in this image.
The Distributor Address is in the format: "Street Address, Postcode, State".
I need to retrieve only "Postcode" and "State" and combine them.
The new column should be like this ➡"NSW2007","VIC3182"...
How could I retrieve the specific letters and combine them?
You can use FILTERXML if you have the newest version of Excel. See Excel - Extract substring(s) from string using FILTERXML for an excellent overview.
In this case, something like the below should work:
EDIT: overlooked the specific format you wanted
=FILTERXML("<t><s>"&SUBSTITUTE(A1,",","</s><s>")&"</s></t>","//s[3]")&
FILTERXML("<t><s>"&SUBSTITUTE(A1,",","</s><s>")&"</s></t>","//s[2]")
Well, here is a different way:
=RIGHT(A2,3)&","&TRIM(MID(A2,FIND(",",A2,1)+2,LEN(A2)-FIND(",",A2,FIND(",",A2,1)+1)))
This does rely on the state being the last 3 characters and the postcode after the first comma...
There are several ways of solving that. I will show a solution using a few basic functions: RIGHT, MID and LEN.
Assuming your data is on A1:
=RIGHT(A1,3)&MID(A1, LEN(A1)-8, 4)
RIGHT returns the 3 last characters from the cell A1.
MID returns the middle of the cell given a starting position and a length.
LEN gives you the starting position of the zip code, which is always the length of the string - 8 in your table.
Is it essential that your data is well organized as in the image to work well. One alternative is finding the ", " as below.
=RIGHT(A1,3)&MID(A1, FIND(", ",A1)+2,4)

Find value within cell from a series in Excel

I have a list of addresses, such as this:
Lake Havasu,  Lake Havasu City,  Arizona.
St. Johns River,  Palatka,  Florida.
Tennessee River,  Knoxville,  Tennessee.
I would like to extract the State from these addresses and then have a column showing the abbreviated State name (AZ, FL, TN etc.).
I have a table that has the States with their abbreviation and once I extract the State, doing a simple INDEX MATCH to get the abbreviation is easy. I don't want to use text-to-columns because this file will constantly have values added to it and it would be much easier to just have a formula that does the extraction for me.
The ways I've tried to approach this that have failed so far are:
Some kind of SEARCH() function that looks at the full State list and tries to find a value that exists in the cell
A MID or RIGHT approach to only capture the last section but I can't work out how to have FIND only look for the second ", "
A version of INDEX MATCH but that fails because I can't find a good way to search or find the values as per approach (1)
Any help would be appreciated!
Please try this formula, where A2 is the original text.
=FILTERXML("<data><a>" & SUBSTITUTE(A2,", ","</a><a>") & "</a></data>","data/a[3]")
An alternative would be to look for the 2nd comma as shown below. Note that the "50" in the formula is an irrelevant number required by the MID() function. It shouldn't be smaller than the number of characters you need to return, however.
Char(160) is a character that wouldn't (shouldn't) naturally occur in your text, as it might if the text comes from a UNIX database. You can replace it with another one that fits the description.
=TRIM(MID(A2, FIND(CHAR(160),SUBSTITUTE(A2,",",CHAR(160),2)) + 1,50))
The following variation of the above would remove the final period. It will fail if there is anything following the period, such as an unwanted blank. That could be accommodated within the formula as well but it would be easier to treat the original data, if that is an option for you.
=TRIM(MID(LEFT(A2, LEN(A2)-1), FIND(CHAR(160),SUBSTITUTE(A2,",",CHAR(160),2)) + 1,50))
To find the abbreviation I would recommend to use VLOOKUP rather than INDEX/MATCH.
Use this (screenshot refers):
=MID(MID(B3,1,LEN(B3)-1),SEARCH(",",B3,SEARCH(",",B3,1)+1)+3,LEN(B3))

Looking to remove a space in one of the results while performing multiple mid searches on a column

I am trying to embed a SUBSTITUTE in my function, but I am not sure where to incorporate it. I am trying to extract just the text "Scrumactiviteiten" but in the source data sometimes a space will be in there. A sample:
Column A
1 Team xxxx 2018-17 Scrumactiviteiten 123 and then something
2 Team xxxx 2018-17 Scrum activiteiten 123 and then something
Column B (My formula)
1 Scrumactiviteiten
2 Scrum activiteiten
The function I used to extract it (ignore the "Balans" search please):
=IFERROR(IFERROR(IFERROR(MID(A1;SEARCH("Scrum activiteiten";A1;1);18);
MID(A1;SEARCH("Scrumactiviteiten";A1;1);17));MID(A1;SEARCH("Balans";A1;1);10));" ")
This works fine, but to remove the space I tried to embed a SUBSTITUTE where I use the mid search result as the old text and provide "Scrumactiviteiten" as the new text:
=IFERROR(IFERROR(IFERROR(SUBSTITUTE(A24;((MID(A24;SEARCH("Scrum activiteiten";A24;1);18)));"Scrumactiviteiten");MID(A24;SEARCH("Scrumactiviteiten";A24;1);17));MID(A24;SEARCH("Balans";A24;1);10));" ")
The result however is a copy of the full string. I also tried putting the substitute before the search but that would not work either. I am pretty new to Excel formula's and I think I messed up the order or just plain don't understand how I embed a SUBSTITUTE in the formula I created. Some explanation would be much appreciated on what I'm doing wrong! Thank you in advance,
Mark
The problem is you are not providing the correct arguments to the function, try this formula:
=IFERROR(IFERROR(IFERROR(SUBSTITUTE(((MID(A24;SEARCH("Scrum activiteiten";A24;1);18)));" ";"");MID(A24;SEARCH("Scrumactiviteiten";A24;1);17));MID(A24;SEARCH("Balans";A24;1);10));" ")
To use SUBSTITUTE you first provide the string in which you want to replace something, the next two arguments are the string you want replaced and the string you want to replace it with. So for example =SUBSTITUTE("Scrum activiteiten";" ";"") returns Scrumactiviteiten as the space " " is replaced with an empty string "".

How do I create an if-then formula in excel that produces a written text answer?

=IF(J35>130,["Way_Above_Average"]),IF(AND(J35>=119,J35<=130),["Above_Average"]),IF(AND(J35>=109,J35<=118),["High_Average"]),IF(AND(J35>=89,J35<=108),["Average"]),IF(AND(J35>=80,J35<=90),["Low_Average"]),IF(AND(J35>=68,J35<=79),["Below_Average"]),IF(AND(J35>=61,J35<=67),["Way_Below_Average"]))
I am trying to create a "report template" that takes the raw testing data of students from a Normed test...and creates a description of the score as compared to peers in the same grade.
=IF(J35>130,["Way_Above_Average"]),IF(AND(J35>=119,J35<=130),["Above_Average"]),IF(AND(J35>=109,J35<=118),["High_Average"]),IF(AND(J35>=89,J35<=108),["Average"]),IF(AND(J35>=80,J35<=90),["Low_Average"]),IF(AND(J35>=68,J35<=79),["Below_Average"]),IF(AND(J35>=61,J35<=67),["Way_Below_Average"]))
I keep getting error messages about syntax and name...want this to create a text descriptor from the raw standard score.
Just taking the first two levels, I would put:
=IF(J35>130,"Way_Above_Average",IF(J35>=119,"Above_Average"),"")
As you should not need the square brackets or the and() as if the number tested is above 130 it has already been controlled.
Just for fun, here is a vlookup equivalent:
You can use:
=IFERROR(CHOOSE(MATCH(J35,{61,68,80,89,109,119,130}),"Way_Below_","Below_","Low_","","High_","Above_","Way_Above_") & "Average","Below_61")

Excel First Word (with error checking)

While I can extract the first word from a cell containing multiple text values with error checking to return the only word if no multiple values exist. I cannot seem to wrap my brain around adding more checks (or if it is even possible in the same nested formula) for situations where some of the source cells contain a comma between multiple words. Example, the formula below will return "James" from "James Marriott". But, it returns "James," from "James, Marriott". If all of my cells in the range were consistent that would be easy, but they aren't. Attempts to nest multiple find statements have resulted in failure. Suggestions?
=IFERROR(LEFT(A1,FIND(" ",A2)-1),A2)
To compound matters, there are also cells that contain abbreviations as the first word, so somehow I need to account for that as well. For example "J.W. Marriott" where I need to apply the above logic to extract "Marriott".
Here are some examples below:
Text Desired output
James Marriott James
James, Marriott James
Able Acme Able
Golden, Eagle Golden
J.W. Marriott Marriott
A.B. Acme Acme
you could use regex (to set up please look at the post here)
Then you can extract the desired word with a formula like:
=regex(A1, "(?![Etc])[a-zA-Z]{2,}")
(This is searching for a pattern of two or more lower or upper case letters in the cell A1...and not searching for Etc)

Resources