I am trying to take a list of URL links and extract the root domain from each for further comparison.
The issue I am running into is that my files consist of 4 different URLs: http://domain.com/something/; https://domain.com/something/; http://www.domain.com/something/; and https://www.domain.com/something/
I have 2 separate formulas that work, but only 1 does for the "www" URLs and the other for the "non-www" files. See below:
www
=IF(ISERROR(FIND("//www.";A2));MID(A2;FIND(":";A2;4)+3;FIND(":";A2;4)-3);MID(A2;FIND(":";A2;4)+7;FIND("/";A2;9)-FIND(":";A2;4)-7))
non-www
=IF(ISERROR(FIND("//";A2));MID(A2;FIND(":";A2;4)+3;FIND(":";A4;4)-3);MID(A2;FIND(":";A2;4)+3;FIND("/";A2;9)-FIND(":";A2;4)-3))
How can I create 1 single formula that will check all 4 types of URLs and extract the domains?
I have attached my test document to view each formula working separately. Thank you very much if anyone can help.
Creating IF/Else Formula - Extract Root Domain
-
- Posts: 3
- Joined: Tue Jun 25, 2019 5:45 am
Creating IF/Else Formula - Extract Root Domain
- Attachments
-
- formula.ods
- (10.41 KiB) Downloaded 95 times
Cris
OpenOffice 4.1.6
OpenOffice 4.1.6
Re: Creating IF/Else Formula - Extract Root Domain
Are your domains limited to .com; or do they include generic TLDs; might they have a country code like .co.uk or .com.au?
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
-
- Posts: 3
- Joined: Tue Jun 25, 2019 5:45 am
Re: Creating IF/Else Formula - Extract Root Domain
They are all types of domains, including subdomains. I appreciate your time in helping.robleyd wrote:Are your domains limited to .com; or do they include generic TLDs; might they have a country code like .co.uk or .com.au?
Cris
OpenOffice 4.1.6
OpenOffice 4.1.6
Re: Creating IF/Else Formula - Extract Root Domain
Use helper cells for the simplier formulas. When you store the partial results in a some separated cell cells, then you not needed to repeat the parts of the formula in a huge single formula.
Last edited by Zizi64 on Tue Jun 25, 2019 7:45 am, edited 1 time in total.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
-
- Posts: 3
- Joined: Tue Jun 25, 2019 5:45 am
Re: Creating IF/Else Formula - Extract Root Domain
Thanks, so I can do this by using helper cells? I have never used those before so I am somewhat unclear about them.Zizi64 wrote:Use helper cells for the simplier formulas. When you store the partial results in a separated cell, then you not needed to repeat the parts of the formula in a huge single formula.
Cris
OpenOffice 4.1.6
OpenOffice 4.1.6
Re: Creating IF/Else Formula - Extract Root Domain
so I can do this by using helper cells? I have never used those before so I am somewhat unclear about them.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Creating IF/Else Formula - Extract Root Domain
Your use of the term root domain is potentially misleading here; taken literally that might suggest that your expected result for the samples in your first post would all be domain.com or even .com
Can you describe precisely what you are trying to to; for example you might want to strip anything up to and including the first pair of slashes; if the next four characters are www. then strip them; finally strip anything from and including the next slash.
Can you describe precisely what you are trying to to; for example you might want to strip anything up to and including the first pair of slashes; if the next four characters are www. then strip them; finally strip anything from and including the next slash.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers