[Solved] Find and count a character in a cell

Discuss the spreadsheet application
Post Reply
User avatar
normansimonr
Posts: 117
Joined: Wed Feb 16, 2011 8:22 pm
Location: Colombia

[Solved] Find and count a character in a cell

Post by normansimonr »

Hi everyone and good wishes for all. I have a question about calc functions. I've got a cell with the entire name of a person: Ex.: "Gabrielle Antoine Dugos Fermin".

And I need to count the number of times that the blankspace " " appears within the character string, say, 4 times. If I have a cell "John Camille Smith" I'd like to see a number 2, of 2 times.

What function is useful for this?

Thank you very much.
Last edited by normansimonr on Thu Jul 14, 2011 7:33 pm, edited 1 time in total.
OpenOffice 3.1 on Ubuntu-Linux 9.04
User avatar
karolus
Volunteer
Posts: 1226
Joined: Sat Jul 02, 2011 9:47 am

Re: Find and count a character in a cell

Post by karolus »

Hi

Code: Select all

=LEN(A1)-LEN(SUBSTITUTE(A1;" ";""))
Karolus
AOO4, Libreoffice 6.1 on Rasbian OS (on ARM)
Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4)
Libreoffice 24.8… flatpak on Debian 12 (Bookworm) (on RaspberryPI4)
User avatar
normansimonr
Posts: 117
Joined: Wed Feb 16, 2011 8:22 pm
Location: Colombia

Re: Find and count a character in a cell

Post by normansimonr »

Great!... it works. Could you help me explaining this a l'e more?

Thanks.
OpenOffice 3.1 on Ubuntu-Linux 9.04
User avatar
RoryOF
Moderator
Posts: 35064
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Find and count a character in a cell

Post by RoryOF »

Apache OpenOffice 4.1.15 on Xubuntu 22.04.5 LTS
User avatar
normansimonr
Posts: 117
Joined: Wed Feb 16, 2011 8:22 pm
Location: Colombia

Re: Find and count a character in a cell

Post by normansimonr »

Thankyou very much.
OpenOffice 3.1 on Ubuntu-Linux 9.04
NHEngineer
Posts: 1
Joined: Fri Sep 30, 2011 4:10 pm

Re: Find and count a character in a cell

Post by NHEngineer »

karolus wrote:Hi

Code: Select all

=LEN(A1)-LEN(SUBSTITUTE(A1;" ";""))
Karolus
Thanks Karolus, it works slick. You saved the day.

David Lee
David Lee
OpenOffice 3.3.0 on Windows XP
User avatar
thnidu
Posts: 5
Joined: Sun Dec 15, 2013 12:48 am
Location: Philadelphia, PA, USA

Re: [Solved] Find and count a character in a cell

Post by thnidu »

:D Great! I need to count plus signs in a membership activity sheet to know how many people a cell represents, as in
  • Harry: 1 person
    Debra + Pam: 2 people
    Joe + Jo + Ĝo: 3 people
I couldn't think of a way to do it. Once I asked the question, this was the first answer to come up and it's perfect.
/ˈθnɪdu/
OpenOffice 4.0.1 on Mac OS X 10.7.5
ᏌᏊ ᎦᏬᏂᏍᏗ ᎥᏝ ᏰᎵᏊ —One language is never enough.
Dr. Whom: Consulting Linguist, Grammarian, Orthoëpist, and Philological Busybody; also copyeditor and proofreader
Post Reply