=On 6 Apr 2026 at 0:15, James wrote:
Date sent:60;Mon, 6 Apr 2026 00:15:54 -0400</span>
To:0;LibreOffice-list
<users@global.libreoffice.org>
From: James <bjlockie@lockie.ca>
Subject:;[libreoffice-users] switch function in calc
A1 contains the number 14023.
B1 contains the formula =SWITCH(AND(A1>5000,A1<15000),20%,A1>15000,30%)
B1 is showing 30% when I expected 20%.
What am I doing wrong?
Couple issue: As I see it, your are missing logical expressions
incorrectly, and use of switch is wrong. It uses one expression, and
then picks the matching value.
Played with it a little, but major issue with libreoffice getting
confused with logical results, and thus getting a false value, which
causes failures. Had to use the N() to convert to values.Also, looked at using Max() function if
you really wanted to have
both values true. But think more specifics on what you are trying to
do. Think the CHOOSE fundtion might be better? or an if?
1402330.00%"=A1>5000
TRUE"=A1<15000
TRUE"=AND(A1>5000,A11<15000)
TRUE"=A1>15000
FALSE
\u201c=SWITCH(A1>5000+A1<15000+A1>15000,0%,20%,30%)
20.00%\u201c=CHOOSE(N(A1>5000)+(A1<15000)+N(A1>15000),0%,20%,30%)
20.00%
--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/> Privacy Policy:
https://www.documentfoundation.org/privacy
+------------------------------------------------------------+
Michael D. Setzer II - Computer Science Instructor (Retired)60;
mailto:mikes@guam.net 
mailto:msetzerii@gmail.com
mailto:msetzerii@gmx.com
Guam - Where America's Day Begins 
G4L Disk Imaging Project maintainer
http://sourceforge.net/projects/g4l/
+------------------------------------------------------------+
--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy
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.