2013 Archives by date, by thread · List index

# Re: [libreoffice-users] =IF Function

```At 04:03 13/03/2013 -0700, J Taylor wrote:
```
Using Mac 10.8.2 and Libre 4.0.1, I find that the IF function does not place a blank space as the second option.
```
```
I think this is a little confused. Do you mean that IF() appears not to be capable of having a null string (not a blank) as its third parameter? I don't think your problem has much to do with the IF() function, in fact.
```
```
```Have I done something insanely stupid, or is this a bug?
```
```
Neither, I fancy.

```
```Where I should get blank cells I am getting:   #DIV/O!
```
```
=IF(Cn*100/Bn>0;Cn*100/Bn;"")
```
is designed to avoid dividing by zero if your substantive calculation would otherwise require this. But the way you have framed the formula, you carry out the same calculation in the expression Cn*100/Bn>0 in an attempt to avoid the problem. It is when performing that calculation that the error occurs, I think - before the IF() function gets its hands on the result. The ">" comparison cannot be evaluated.
```
```
You need either to do the test in such a way that you do not need to do the impossible calculation or else to test for the error returned. One easy way would be to use
```=IF(N(Bn)=0;"";Cn*100/Bn)
```
This gets the test out of the way before attempting to carry out the calculation. Note that if you used Bn=0 you may have a problem with any B cell not empty but containing a blank (as, for example, your B8); the N() function converts that blank to zero explicitly.
```
I trust this helps.

Brian Barker

--
For unsubscribe instructions e-mail to: users+help@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
```