General Computing
microsoft-excel libreoffice openoffice openoffice-calc
Updated Mon, 22 Aug 2022 13:06:06 GMT

Issue with IF statement in Libreoffice Calc


Here is the statement

=IF(L7>7,"$500",IF(L7>11,"$1200",IF(L7>15,"$2000",$0)))

I simply need this to resolve a value based on the set conditions. I've tried numerous variations but can't seem to get the second or third results.

Unsure if there is something that libreoffice needs that differs from excel format.

I should also state that the cell L7 is using the COUNTA function to get its result.




Solution

From what I can see, you have a missing quote:

=IF(L7>11,"$500,IF(L7>11,"$1200",IF(L7>15,"$2000",$0)))
               ^                                  ^
               +---- here ------------------------+

but I suppose that's just what you entered here on SuperUser.

That being said, I think your mistake is that you need to test with the highest number first:

=IF(L7>15,"$2000",IF(L7>11,"$1200",IF(L7>11,"$500","$0")))
                        ^                ^
                        +----------------+

However, the double limit of 11 means you'll never get $500 in your output.

The quotation around the numbers are also not required:

=IF(L7>15,2000,IF(L7>11,1200,IF(L7>11,500,0)))

Then make that one field a $$$ field (usually called money fields).





Comments (3)

  • +0 – I'll try this at the office tomorrow and let you know if it works. — Jun 29, 2022 at 03:27  
  • +0 – Just tried your function and it returns a TRUE statement instead of a value. By adding the quotation marks back in the function works as intended. Thank you for your help sir! — Jun 29, 2022 at 12:59  
  • +0 – I tested, just in case, and it works in my version... I don't think that the field can be mode to show a boolean. — Jun 29, 2022 at 17:48