[Solved] Split cell value into 2 parts separated by a .

Discuss the spreadsheet application
Post Reply
Max1001
Posts: 4
Joined: Mon Aug 06, 2018 5:19 pm

[Solved] Split cell value into 2 parts separated by a .

Post by Max1001 »

I have spreadsheets with columns of domain names in columns.
I want to add columns to split
exampledomain.com
anotherdomain.net
yetanotherdomain.website
etc

into
exampledomain.com exampledomain com
anotherdomain.net anotherdomain net
yetanothername.website yetanothername website

etc.

I realise this can be done use copying and Text to Columns, but I need to be able to do this in a formula each time I add a new domain into the LH column.
There is no predictable length of either part before or after the . of course.

Formula to do this?

Thanks!
Last edited by Max1001 on Mon Aug 20, 2018 3:26 pm, edited 1 time in total.
Open Office 4.1.3 on Windows 10
FJCC
Moderator
Posts: 9277
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Formula to split cell value into 2 parts separated by a

Post by FJCC »

If there is only one ., this will extract the text before the .

Code: Select all

=LEFT(A1;FIND(".";A1) -1 )
and this will extract the text after the .

Code: Select all

=RIGHT(A1;LEN(A1) - FIND(".";A1))
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Max1001
Posts: 4
Joined: Mon Aug 06, 2018 5:19 pm

Re: Formula to split cell value into 2 parts separated by a

Post by Max1001 »

Thanks very much. This worked a treat.

I should have said I needed to retain the . in the 2nd column, which I accomplished using Concatenate as follows:
=(CONCATENATE("."; RIGHT( $A1;LEN($A1)-FIND("."; $A1))))
Open Office 4.1.3 on Windows 10
Bald Eagle
Posts: 68
Joined: Wed Apr 19, 2017 9:22 pm

Re: [SOLVED] split cell value into 2 parts separated by a .

Post by Bald Eagle »

I should have said I needed to retain the . in the 2nd column, which I accomplished using Concatenate as follows:
=(CONCATENATE("."; RIGHT( $A1;LEN($A1)-FIND("."; $A1))))
Or you could have used the "&" operator, or just adjusted the formula as follows to include that extra dot character.

RIGHT ( $A1; LEN($A1) - FIND("."; $A1) + 1 )

or

RIGHT ( $A1; LEN($A1) - (FIND("."; $A1) - 1) )

Always good to have backup methods :)
OpenOffice 4.1.1 on Windows 7
Post Reply