Ask Your Question

Count chars in a column [closed]

asked 2016-03-08 18:42:56 +0100

paparucino gravatar image

Hi all, Im new to libreoffice calc so, pls, be patient. I have a column which may contain only "M"s if the event is in the morning or only "P"s if its in the noon. I need to count the occurences of "M" or "P". What Im able to to is =COUNTIF(J6:J314,"=M") but Im not able to do the OR . Something like: Count the occurences of "M" or "P" in the range J6:J314

Thank youin advance paparucino

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by paparucino
close date 2016-03-11 18:23:20.112479

2 Answers

Sort by » oldest newest most voted

answered 2016-03-10 20:06:58 +0100

karolus gravatar image

updated 2016-03-10 20:08:59 +0100


=COUNTIF( J6:J314 , "M|P" )

check →Tools→Options→Calc→calculate→→[x]allow regular Expressions ...

edit flag offensive delete link more

answered 2016-03-10 19:14:02 +0100

Ratslinger gravatar image

Hello, I may have made this more complex than it needs to be but here goes.


This checks if the current time is less than noon and if it is looks for "M"'s and gives a count and if not it looks for "P"'s and gives a count. Is this what you are looking for?

edit flag offensive delete link more


Can't read anything about COUNTIF dependent from Current Time

karolus gravatar imagekarolus ( 2016-03-10 20:01:52 +0100 )edit

The question is somewhat confusing - Column contains only M or P (nothing else so you already have count it's # of rows). "...need to count occurences of "M" or "P"" not M & P. Just not clear.

Ratslinger gravatar imageRatslinger ( 2016-03-10 20:19:18 +0100 )edit

The real answer here may be one count of M's and one count of P's.

Ratslinger gravatar imageRatslinger ( 2016-03-10 20:27:05 +0100 )edit

Yes, if there is nothing else, we can simply =COUNTA(J6:J314)

karolus gravatar imagekarolus ( 2016-03-10 20:37:13 +0100 )edit

Im really sorry, I was hasty and didnt read correctly the first karolus answer (=COUNTIF( J6:J314 , "M|P" )). I made the modifications he suggested in Tools.... and everything is OK.

Thank you guys for you answers

paparucino gravatar imagepaparucino ( 2016-03-11 18:22:51 +0100 )edit

Question Tools

1 follower


Asked: 2016-03-08 18:42:56 +0100

Seen: 48 times

Last updated: Mar 10 '16