# Count chars in a column

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

paparucino

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

``````=IF(HOUR(NOW())<12,COUNTIF(J6:J314,"M"),COUNTIF(J6:J314,"P"))
``````

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?

Can’t read anything about `COUNTIF dependent from Current Time`

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.

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

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

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

Hallo

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

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