Bug 131469 - Add an IFVALUE function to Calc
Summary: Add an IFVALUE function to Calc
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.4.1.2 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-21 17:50 UTC by director84
Modified: 2020-03-21 18:12 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description director84 2020-03-21 17:50:03 UTC
Imagine the following situation: You have a cell in column A which contains a value in dependence of which you want to set the value of a cell in columb B.

Expamle:  Cell B4 depends on A1.

Cell A1      Cell B4
   1             A
   13            B
   27            C
   65            D
   77            E

Normally you would have to do something like this in the formula of cell B4:

= IF (A1=1;"A" ; IF (A1=13;"B"; IF (A1=27;"C"; IF (A1=65;"D"; IF (A1=77;"E" ; "" )))))

That's why I suggest to add a new function "IFVALUE", or "WENNWERT" in the German localization.

The usage would be like this:

= IFVALUE (referenced cell ; IF-value1;THEN-value1 ; IF-value2;THEN-value2 ; IF-value3;THEN-value3 ; ELSE-value)

So the above example could be shortened like this:
= IFVALUE (A1 ; 1;"A"; 13;"B"; 27;"C"; 65;"D"; 77;"E"; "")
Comment 1 GerardF 2020-03-21 18:01:20 UTC
The function you are asking for already exist : SWITCH
=SWITCH(A1;1;"A";13;"B";27;"C";65;"D";77;"E"; "")
Comment 2 director84 2020-03-21 18:12:45 UTC
Oh, I see. I didn't know that. Thank you! "Switch" was not right what sprung to my mind when I was thinking about how this function could be called if it existed. :-]