Ask LibreOffice - RSS feedhttps://ask.libreoffice.org/en/questions/Questions and answers for LibreOfficeenFri, 11 Mar 2016 18:22:51 +0100Count chars in a columnhttps://ask.libreoffice.org/en/question/65950/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
Thank youin advance
paparucinoTue, 08 Mar 2016 18:42:56 +0100https://ask.libreoffice.org/en/question/65950/count-chars-in-a-column/Answer by Ratslinger for <p>Hi all,
Im new to libreoffice calc so, pls, be patient.
I have a column which may contain <em>only</em> "M"s if the event is in the morning or <em>only</em> "P"s if its in the noon. I need to count the occurences of "M" or "P". What Im able to to is <strong>=COUNTIF(J6:J314,"=M")</strong> but Im not able to do the OR .
Something like: Count the occurences of "M" or "P" in the range J6:J314</p>
<p>Thank youin advance
paparucino</p>
https://ask.libreoffice.org/en/question/65950/count-chars-in-a-column/?answer=66131#post-id-66131Hello, 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?
Thu, 10 Mar 2016 19:14:02 +0100https://ask.libreoffice.org/en/question/65950/count-chars-in-a-column/?answer=66131#post-id-66131Comment by karolus for <p>Hello, I may have made this more complex than it needs to be but here goes.</p>
<pre><code>=IF(HOUR(NOW())<12,COUNTIF(J6:J314,"M"),COUNTIF(J6:J314,"P"))
</code></pre>
<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?</p>
https://ask.libreoffice.org/en/question/65950/count-chars-in-a-column/?comment=66135#post-id-66135Can't read anything about `COUNTIF dependent from Current Time`Thu, 10 Mar 2016 20:01:52 +0100https://ask.libreoffice.org/en/question/65950/count-chars-in-a-column/?comment=66135#post-id-66135Comment by Ratslinger for <p>Hello, I may have made this more complex than it needs to be but here goes.</p>
<pre><code>=IF(HOUR(NOW())<12,COUNTIF(J6:J314,"M"),COUNTIF(J6:J314,"P"))
</code></pre>
<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?</p>
https://ask.libreoffice.org/en/question/65950/count-chars-in-a-column/?comment=66138#post-id-66138The 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.Thu, 10 Mar 2016 20:19:18 +0100https://ask.libreoffice.org/en/question/65950/count-chars-in-a-column/?comment=66138#post-id-66138Comment by paparucino for <p>Hello, I may have made this more complex than it needs to be but here goes.</p>
<pre><code>=IF(HOUR(NOW())<12,COUNTIF(J6:J314,"M"),COUNTIF(J6:J314,"P"))
</code></pre>
<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?</p>
https://ask.libreoffice.org/en/question/65950/count-chars-in-a-column/?comment=66199#post-id-66199Im 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 answersFri, 11 Mar 2016 18:22:51 +0100https://ask.libreoffice.org/en/question/65950/count-chars-in-a-column/?comment=66199#post-id-66199Comment by karolus for <p>Hello, I may have made this more complex than it needs to be but here goes.</p>
<pre><code>=IF(HOUR(NOW())<12,COUNTIF(J6:J314,"M"),COUNTIF(J6:J314,"P"))
</code></pre>
<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?</p>
https://ask.libreoffice.org/en/question/65950/count-chars-in-a-column/?comment=66146#post-id-66146Yes, if there is nothing else, we can simply **`=COUNTA(J6:J314)`**Thu, 10 Mar 2016 20:37:13 +0100https://ask.libreoffice.org/en/question/65950/count-chars-in-a-column/?comment=66146#post-id-66146Comment by Ratslinger for <p>Hello, I may have made this more complex than it needs to be but here goes.</p>
<pre><code>=IF(HOUR(NOW())<12,COUNTIF(J6:J314,"M"),COUNTIF(J6:J314,"P"))
</code></pre>
<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?</p>
https://ask.libreoffice.org/en/question/65950/count-chars-in-a-column/?comment=66140#post-id-66140The real answer here may be one count of M's and one count of P's.Thu, 10 Mar 2016 20:27:05 +0100https://ask.libreoffice.org/en/question/65950/count-chars-in-a-column/?comment=66140#post-id-66140Answer by paparucino for <p>Hi all,
Im new to libreoffice calc so, pls, be patient.
I have a column which may contain <em>only</em> "M"s if the event is in the morning or <em>only</em> "P"s if its in the noon. I need to count the occurences of "M" or "P". What Im able to to is <strong>=COUNTIF(J6:J314,"=M")</strong> but Im not able to do the OR .
Something like: Count the occurences of "M" or "P" in the range J6:J314</p>
<p>Thank youin advance
paparucino</p>
https://ask.libreoffice.org/en/question/65950/count-chars-in-a-column/?answer=66197#post-id-66197I beg your pardon for the delay.
The first solution ( =COUNTIF( J6:J314 , "M|P" ) always shows 0.
@ Ratslinger: how could I perform your solution? I tried with `COUNTIF(OR(J6:J314 ='M',J6:J314 ='P'))` but it doesnt work
@ karolus: the problem is that in the colums there are could be other characters which cant be taken into accountFri, 11 Mar 2016 18:14:19 +0100https://ask.libreoffice.org/en/question/65950/count-chars-in-a-column/?answer=66197#post-id-66197Answer by karolus for <p>Hi all,
Im new to libreoffice calc so, pls, be patient.
I have a column which may contain <em>only</em> "M"s if the event is in the morning or <em>only</em> "P"s if its in the noon. I need to count the occurences of "M" or "P". What Im able to to is <strong>=COUNTIF(J6:J314,"=M")</strong> but Im not able to do the OR .
Something like: Count the occurences of "M" or "P" in the range J6:J314</p>
<p>Thank youin advance
paparucino</p>
https://ask.libreoffice.org/en/question/65950/count-chars-in-a-column/?answer=66136#post-id-66136Hallo
=COUNTIF( J6:J314 , "M|P" )
check **`→Tools→Options→Calc→calculate→→[x]allow regular Expressions ...`**
Thu, 10 Mar 2016 20:06:58 +0100https://ask.libreoffice.org/en/question/65950/count-chars-in-a-column/?answer=66136#post-id-66136