Remove all characters from a url except the root domain and domain extension

christojuan

New Member
Joined
Feb 19, 2013
Messages
6
Hi - This formula takes any url and removes everything that I want except that it does not remove the forward slash and all characters after that.


Code:
=IFERROR(MID(B10, FIND("^", SUBSTITUTE(B10,".","^", LEN(B10)-LEN(SUBSTITUTE(B10, ".", ""))-IF(ISNUMBER(SEARCH(OR(".co.",".com."), B10)), 2, 1)))+1, 100),B10)


The formula evaluates the items in the left column to the result in the right, but what I am looking for is for every url example in the left column to generate "woohoo.com" as a result of the formula in the right column, regardless of the top level domain extension (.com, .ru. .co, .net, .jp etc -in those cases it would generate woohoo.com, woohoo.ru, woohoo.net, woohoo.jp etc.).


http://www.bob.woohoo.com woohoo.com
http://www.bob.woohoo.com/ woohoo.com/
http://www.bill.woohoo.com woohoo.com
http://www.bill.woohoo.com/folder1 woohoo.com/folder1
http://www.bill.woohoo.com/folder1/ woohoo.com/folder1/
http://www.bill.woohoo.com/folder1/folder2 woohoo.com/folder1/folder2
http://www.bill.woohoo.com/folder1/folder2/ woohoo.com/folder1/folder2/
http://bill.woohoo.com woohoo.com
www.bill.woohoo.com woohoo.com
bill.woohoo.com woohoo.com


I would really appreciate help getting that formula to achieve that (if it is possible).


Thanks very much in advance!

 
Last edited:
Hi Rick,

Thanks for the help. Could you make it so it strips https:// and https://www. as well - I still want the http:// and http://www.? Also, can you remove the part that gets rid of the subdomain - I want the sub domains? Thanks a LOT!!!
 
Last edited:
Upvote 0

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi Rick,

Thanks for the help. Could you make it so it strips https:// and https://www. as well - I still want the http:// and http://www.? Also, can you remove the part that gets rid of the subdomain - I want the sub domains? Thanks a LOT!!!
What is the "sub-domain"? Please show a sample of before and after for a URL with a subdomain in it.
 
Upvote 0
subexample.example.com
I just noticed that you are not the original poster for this thread. Given that, I think you should post several before and after examples so that we can see exactly the kind of text you have for existing data and exactly how you want it the resulting output to appear.
 
Upvote 0
OK here you go. Does this make sense?


http://bob.woohoo.combob.woohoo.com
www.bob.woohoo.com/bob.woohoo.com
http://www.bill.woohoo.combill.woohoo.com
https://www.bill.woohoo.com/folder1bill.woohoo.com
http://bill.woohoo.com/folder1/bill.woohoo.com
http://www.bill.woohoo.com/folder1/folder2bill.woohoo.com
http://www.bill.woohoo.com/folder1/folder2/bill.woohoo.com
http://bill.woohoo.combill.woohoo.com
www.bill.woohoo.combill.woohoo.com
bill.woohoo.combill.woohoo.com
http://portal.hud.gov/hudportal/HUD/statesportal.hud.gov
http://mapquest.com/mapquest.com
http://historymatters.gmu.edu/browse/refdesk/historymatters.gmu.edu
http://blast.ncbi.nlm.nih.gov/blast.ncbi.nlm.nih.gov
http://www.tfl.gov.uk/modalpages/2605.aspxtfl.gov.uk
http://www.constantcontact.com/features/tours.jsp
constantcontact.com

<tbody>
</tbody>
 
Upvote 0
OK here you go. Does this make sense?


http://bob.woohoo.combob.woohoo.com
www.bob.woohoo.com/bob.woohoo.com
http://www.bill.woohoo.combill.woohoo.com
https://www.bill.woohoo.com/folder1bill.woohoo.com
http://bill.woohoo.com/folder1/bill.woohoo.com
http://www.bill.woohoo.com/folder1/folder2bill.woohoo.com
http://www.bill.woohoo.com/folder1/folder2/bill.woohoo.com
http://bill.woohoo.combill.woohoo.com
www.bill.woohoo.combill.woohoo.com
bill.woohoo.combill.woohoo.com
http://portal.hud.gov/hudportal/HUD/statesportal.hud.gov
http://mapquest.com/mapquest.com
http://historymatters.gmu.edu/browse/refdesk/historymatters.gmu.edu
http://blast.ncbi.nlm.nih.gov/blast.ncbi.nlm.nih.gov
http://www.tfl.gov.uk/modalpages/2605.aspxtfl.gov.uk
http://www.constantcontact.com/features/tours.jsp
constantcontact.com

<tbody>
</tbody>
In your first post you said, "Could you make it so it strips https:// and https://www. as well - I still want the http:// and http://www.?" In your above examples, you show the http:// and http://www. being removed but the red highlighted part from in the quote says you want to keep them... please clarify.
 
Last edited:
Upvote 0
I think this formula will do what you want...
Code:
[table="width: 500"]
[tr]
	[td]=TRIM(MID(SUBSTITUTE(REPLACE(MID(SUBSTITUTE("//"&A1,"//www.","//"),3,500),1,IFERROR(FIND("//",A1)+1,0),""),"/",REPT(" ",500)),1,500))[/td]
[/tr]
[/table]
 
Upvote 0

Forum statistics

Threads
1,216,009
Messages
6,128,261
Members
449,435
Latest member
Jahmia0616

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top