2014 Archives by date, by thread · List index

# Re: [libreoffice-users] Calc Function

```At 10:17 11/01/2014 -0800, James E Lang wrote:
```
Please fill in the blank ("___") below with a function name or tell me there is no such function:
```
```
SUM(range) is to SUMIF(range1,criteria,range2) as COUNT(range) is to ___(range1,criteria,range2)
```
```
COUNTIF would seem to be the logical answer but I don't think it supports the third parameter and thus it is not analogous to COUNT.
```
I'm wanting to use it as follows:

```
=IF(___(A\$3:A7,A7,Q\$3:Q7)=___(A\$3:A7,A7,R\$3:R7),SUM(A\$3:A7,A7,R\$3:R7)-SUM(A\$3:A7,A7,Q\$3:Q7),"Error 4")
```
```
Where Error 4 means that the start miles in Q\$3:Q7 and end miles in R\$3:R7 are not properly paired and thus the miles driven on date A7 cannot be determined.
```
```
Your formula - if it worked - would count the cells in columns Q and R which correspond to cells in column A which match your criterion for the contents of the cells in column A. As has already been pointed out, this is no different from counting the relevant cells in column A - and this means that your test of equality will always be true and your error message will never be triggered. The COUNTIF(), even if you could use it as you hoped, would pick out the appropriate date but not take any account of the contents of the cells in columns Q and R. (This is no doubt why COUNTIF() cannot have that third parameter: it would be of no use!)
```
```
... the corresponding cell in column Q or R respectively contains a number (otherwise it's a zero length string).
```
```
At no point have you tested the contents of relevant cells in columns Q and R, which would be counted even if they were empty.
```
```
But more fundamentally, counting such cells is surely an insufficient test anyway: if you have the same number of missing "start miles" as missing "end miles", your counts would match up (and no error would be triggered) even if the missing values were in different rows.
```
I trust this helps.

Brian Barker

--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted
```

### Context

Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.