A B
1 www.harborfreight.com/ www.harborfreight.com
2 totsy.com totsy.com
3 www.totsy.com/customer/account/login/ www.totsy.com/customer/account/login
4 www.pandawill.com/ www.pandawill.com
I am trying to reduce the above Column A values to their simplest domain name form by removing every character after the first "/". It doesn't work on line 3 above using this formula:
=IF(ISERROR(SEARCH("/",A3)),A3,TRIM(LEFT(A3,FIND("|",SUBSTITUTE(A3,"/","|",LEN(A3)-LEN(SUBSTITUTE(A3,"/",""))))-1)))
Obviously my formula above seems to be stripping every character after the last "/". Can you please recommend the correct change?
Thanks,
Dan
Your formula seems very convoluted to me, is there a reason you are messing with substitutions?
This seemingly works fine for me:
=IFERROR(LEFT(A1,FIND("/",A1)-1),A1)
In that it returns the string before the first /, or just returns the string if / is not found.
Use this formula.
=MID(A1;1;if(ISERR(find("/";A1))=true;"99";find("/";A1)-1))
It finds the "/" character and returns text before it. Errorproof.
Related
I have a column called 'cArticle' in excel, containing data in below format. I have a requirement to extract in another column the code that is in brackets. Ex- Z1A,F5C,etc
cArticle
Molecular Dispersion (Z1A)
Acrona Perse (F5C)
Leco Spers (HLP)
Cullar Dipters (LPP)
I have managed to get it partially working by using the below formula, but it still returns with values with the closing brackets. How can I modify it to get the desired results?
RIGHT(cArticle,4)
Thank you in advance!
If the string always ends with (XXX) and the content in the brackets is always 3 digit. You can also try:
=LEFT(RIGHT(cArticle,4),3)
If your code is always at the farthest right and is only 3 characters long, you can use formula as below
=SUBSTITUTE(RIGHT(cArticle,4),")","")
However if your code is not always at the farthest right and may be more or less than 3 characters than you can use formula below, which will work in all cases even if there is no code present
=IFERROR(MID(cArticle,FIND("(",cArticle)+1,FIND(")",cArticle)-FIND("(",cArticle)-1),"No Code")
I have a bunch of URLs in a column like below:
https://www.example.com/xx/yy/product-name-could-be-30238543/
https://www.example.com/xx/yy/product-name-might-70293274/
https://www.example.com/xx/yy/product-name-may-40242653/
I wish to extract the ID's from the id but not with the last / in them. The right function gives me below:
40242653/ but i wish to get rid of the ID's too within the same function so can someone suggest a way?
Otherwise, i have to use another replace function separately to get rid of ending trailing slashes.
Thanks,
If all the IDs have 8 numerals, then you can use:
=LEFT(RIGHT(A1,9),8)
If they have more or less than 8 numerals, then ignore this answer.
I have found this to be easier to use (It extracts everything after the last occurrence of - in them.
SUBSTITUTE(RIGHT(A1;LEN(A1)-FIND("#";SUBSTITUTE(A1;"-";"#";(LEN(A1)-LEN(SUBSTITUTE(A1;"-";"")))/LEN("\"))));"/";"";1)
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 "".
Sorry in advance for any errors in the post as i am new. Basically i am trying to do a vlook up searching for the first 8 characters and the last 2 characters of a single string ie. (20.5/020/025/IE). I have separated what i need by a left and right formula as shown and that works right and the result is as shown under
=LEFT(A2,FIND("/",A2)+3)& RIGHT(A2,FIND("/",A2)-2)
First 8 Last 2
Result 20.5/010/ IE
What im searching 20.5/020/025/IE
Now i have no clue how to do a partial vlookup to match values that starts with the first 8 and ends in last 2. Any help would be greatly appreciated.
Thanks
MATCH allows the use of wildcards, so use something like this:
=INDEX(B:B,MATCH("THIS IS " & "*" & "CC",A:A,0))
How do I get the last character of a string using an Excel function?
No need to apologize for asking a question! Try using the RIGHT function. It returns the last n characters of a string.
=RIGHT(A1, 1)
=RIGHT(A1)
is quite sufficient (where the string is contained in A1).
Similar in nature to LEFT, Excel's RIGHT function extracts a substring from a string starting from the right-most character:
SYNTAX
RIGHT( text, [number_of_characters] )
Parameters or Arguments
text
The string that you wish to extract from.
number_of_characters
Optional. It indicates the number of characters that you wish to extract starting from the right-most character. If this parameter is omitted, only 1 character is returned.
Applies To
Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000
Since number_of_characters is optional and defaults to 1 it is not required in this case.
However, there have been many issues with trailing spaces and if this is a risk for the last visible character (in general):
=RIGHT(TRIM(A1))
might be preferred.
Looks like the answer above was a little incomplete try the following:-
=RIGHT(A2,(LEN(A2)-(LEN(A2)-1)))
Obviously, this is for cell A2...
What this does is uses a combination of Right and Len - Len is the length of a string and in this case, we want to remove all but one from that... clearly, if you wanted the last two characters you'd change the -1 to -2 etc etc etc.
After the length has been determined and the portion of that which is required - then the Right command will display the information you need.
This works well combined with an IF statement - I use this to find out if the last character of a string of text is a specific character and remove it if it is. See, the example below for stripping out commas from the end of a text string...
=IF(RIGHT(A2,(LEN(A2)-(LEN(A2)-1)))=",",LEFT(A2,(LEN(A2)-1)),A2)
Just another way to do this:
=MID(A1, LEN(A1), 1)