[Solved] Copy only alphabetic characters from cell

Discuss the spreadsheet application
Post Reply
TheOldThug
Posts: 22
Joined: Fri Jun 12, 2020 3:03 pm

[Solved] Copy only alphabetic characters from cell

Post by TheOldThug »

I want a cell equal to another cell but I only want the text copied, no numbers. Is this possible to set up? For example the cell to be copied is Timmy 14. However I only want Timmy copied not the number. Cell A1 has Timmy 14. In cell B1 that I am copying A1 into, I am using =A1. However it then copies name and number, don't want number

 Edit: Changed subject, was Copy only text from cell 
Make your post understandable by others 
-- MrProgrammer, forum moderator 
Last edited by TheOldThug on Tue Jun 04, 2024 3:33 am, edited 3 times in total.
Open Office 4.1.7 on Windows 10
FJCC
Moderator
Posts: 9624
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Copy only text from cell

Post by FJCC »

Can you give an example of what you need to do? Is there any pattern to the text and numbers? Are you working with a word followed by numbers or some other consistent pattern?
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.
TheOldThug
Posts: 22
Joined: Fri Jun 12, 2020 3:03 pm

Re: Copy only text from cell

Post by TheOldThug »

It is a golf scorecard. The cell has Name and handicap, for example Timmy 14. The other side of the scorecard I want only Timmy copied, not the handicap.
Open Office 4.1.7 on Windows 10
FJCC
Moderator
Posts: 9624
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Copy only text from cell

Post by FJCC »

Judging from your example, we can pull the text that occurs before the first space. A formula for that is

Code: Select all

=LEFT(A1;SEARCH(" ";A1) - 1)
If the names can have spaces in them, like John Andrew, you can pull the text that ends two positions before the first numeric digit.

Code: Select all

=LEFT(A3; SEARCH("\d"; A3) - 2)
For that to work, you have to go to the menu Tools -> Options, expand the OpenOffice Calc list on the left, select Calculate, and select Enable Regular Expressions in Formulas.
If there are cases not covered by those formulas, please provide examples of them.
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.
User avatar
Lupp
Volunteer
Posts: 3756
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Copy only alphabetic characters from cell

Post by Lupp »

For users Of LibreOffice V6.2 or higher and trying to solve similar tasks, I attach an example demonstrating the usage of the REGEX() function for the purpose.
DELorGETpartsofCellStringUsingRegex.ods
(15.59 KiB) Downloaded 74 times
There is some help provided concerning this function and the usage of Regular Expressions generally.
A good tutorial: https://www.regular-expressions.info/
The flavour used By LibO (and AOO where applicable) is the one provided by the ICU.
On Windows 10: LibreOffice 25.8.4 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
Post Reply