Error using Count function

Discuss the spreadsheet application
Post Reply
Sean89
Posts: 1
Joined: Tue Aug 27, 2019 10:18 pm

Error using Count function

Post by Sean89 »

Hi all,

I am trying to fix a broken formula.
I have attached a photo.

Using count function i am trying to count all number cells in the range. This works fine except for when the cell has a space or - or / or : basically if i use anything in the cell other than numbers.

The aim is to use the sheet as a rota. Im trying to count the amount of staff that are on shift. 99% of the staff work set shift patterns so they know if they start at 8.15 then their finish time will be 6 hence why there are no finish times. However there are a couple of staff that do smaller and or random shifts and they require a start and finish time. How can i get the cell to count all of the numbered cells???

Thanks in advance
Attachments
20190827_211414-750x359.jpg
Openoffice 4.1 on windows 10
FJCC
Moderator
Posts: 9280
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Error using Count function

Post by FJCC »

COUNT() is not counting cells with - and / in them because it is counting cells that contain pure numbers and not text. Cell content like 8.15 - 6.15 is text. A formula that will count the number of cells that contain a numeric character is

Code: Select all

=COUNTIF(L9:L19;"\d")
For that to work, you have to go to the menu Tools -> Options -> OpenOffice Calc -> Calculate and:
Turn off Search criteria = and <> must apply to whole cells
Turn on Enable regular expression in formulas
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
RusselB
Moderator
Posts: 6646
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: Error using Count function

Post by RusselB »

If you want to count anything that is entered in the cell, then the COUNTA function looks like an option.
No need to change the settings required for FJCC's suggestion.
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
User avatar
Zizi64
Volunteer
Posts: 11362
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Error using Count function

Post by Zizi64 »

I have attached a photo.
It is better to attach a Print Screen image. That will not be blurry.

The best is to upload a real ODF type sample file as an attachment.
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.
Post Reply