IF THEN ELSE in a spreadsheet?

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
kc79
Posts: 30
Joined: Thu Nov 19, 2015 12:44 pm

IF THEN ELSE in a spreadsheet?

Post by kc79 »

Heyho,


Do the spreadsheet may work with " if then else" stuff?



Br kc
eivindkvedalen
Posts: 602
Joined: Tue Jan 29, 2013 10:35 pm

Re: IF THEN ELSE in a spreadsheet?

Post by eivindkvedalen »

kc79 wrote:Heyho,


Do the spreadsheet may work with " if then else" stuff?
Yes, it's similar to the conditional operator in C: <test> ? <true-branch> : <false-branch>

Example: = (A1 > A2) ? 1 : 2

...will give 1 if A1 > A2, and 2 otherwise.

Eivind
kc79
Posts: 30
Joined: Thu Nov 19, 2015 12:44 pm

Re: IF THEN ELSE in a spreadsheet?

Post by kc79 »

Thx
User avatar
ceremcem
Posts: 226
Joined: Sun Jan 07, 2018 11:10 am

Re: IF THEN ELSE in a spreadsheet?

Post by ceremcem »

This doesn't work in FC 0.17:
Screenshot_2018-09-22_16-35-00.png
Screenshot_2018-09-22_16-35-00.png (117.14 KiB) Viewed 2983 times
chrisb
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: IF THEN ELSE in a spreadsheet?

Post by chrisb »

You necrobumped a rather old topic. Consider to open a new and reference the old. Now for your issue:

Omit the brackets, i.e. write

Code: Select all

=B1 > 2 ? 1 : 2
I could have used a screenshot to show this, but writing such things as plain text has two advantages: It saves bandwith! Your image consumes 117.14 Kilobytes, which is approximately 1000 times the size some text would need.

The second reason is, that your image cannot be searched by other users having the same problem.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
ceremcem
Posts: 226
Joined: Sun Jan 07, 2018 11:10 am

Re: IF THEN ELSE in a spreadsheet?

Post by ceremcem »

chrisb wrote: Sat Sep 22, 2018 2:05 pm Omit the brackets, i.e. write

Code: Select all

=B1 > 2 ? 1 : 2
Thanks Chris, that worked.
You necrobumped a rather old topic. Consider to open a new and reference the old.
Searches directly led me to the topic, so I thought someone else would also come here, which in turn made sense to resume the thread.
I could have used a screenshot to show this, but writing such things as plain text has two advantages: It saves bandwith! Your image consumes 117.14 Kilobytes, which is approximately 1000 times the size some text would need.
I've never seen that the bandwidth was a problem before, anyway, I had no choice this time because there were no error messages in the output. I'm filing a bug for this.
The second reason is, that your image cannot be searched by other users having the same problem.
In this particular context, I think previous content is quite enough for further searches (as I found the topic by google search).

Sorry for any inconvenience, it'll take some time to get used to the FreeCAD forum.
Post Reply