Greetings,
Not sure if this is the right place for this, but here it goes ...
I am trying to get one cell to show a result based on what is in another cell.
Details:
Cell D2 will either have Intelligence, Wisdom, or Charisma shown.
I want Cell E2 to show one result if Intelligence is in D2, a different result if Wisdom is in D2, and yet a different result if Charisma is in D2.
I also want Cell F2 to show a different result than E2 based on the same argument.
How would I go about doing this. I know the IF function is what I need, I just don't know how to write it out.
Attached is a small file of what I have so far, and what I am trying to accomplish.
[Solved] Get value based on alternatives; IF function?
[Solved] Get value based on alternatives; IF function?
- Attachments
-
- OpenOffice Help.ods
- (16 KiB) Downloaded 114 times
Last edited by MrProgrammer on Thu Apr 01, 2021 10:40 pm, edited 1 time in total.
Reason: Tagged ✓ [Solved]
Reason: Tagged ✓ [Solved]
Apache OpenOffice 4.1.3
Windows 10 64Bit
Windows 10 64Bit
Re: IF Function
Something like this for E2:
If D2 contains none of the above, ?? is displayed
You could also use a lookup e.g. VLOOKUP..
Code: Select all
=If(D2="Intelligence";"one result";if(D2="Wisdom";"a different result";If(D2="Charisma";"yet a different result"; "??")))
You could also use a lookup e.g. VLOOKUP..
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
- MrProgrammer
- Moderator
- Posts: 4908
- Joined: Fri Jun 04, 2010 7:57 pm
- Location: Wisconsin, USA
Re: Get value based on alternatives; IF function?
Thank you for the attachment. IF() is the wrong function for this task. It might be acceptable for three alternatives, but it will be unsuitable for a few dozen. You need a better approach.Cruise105 wrote:I know the IF function is what I need, I just don't know how to write it out.
XY Problem
You want to perform table lookups. Depending on the situation use MATCH with INDEX, use VLOOKUP, or use HLOOKUP.Cruise105 wrote:Cell D2 will either have Intelligence, Wisdom, or Charisma shown.
I want Cell E2 to show one result if Intelligence is in D2, a different result if Wisdom is in D2, and yet a different result if Charisma is in D2.
In E2: =INDEX($H$2:$J$2;MATCH(D2;$H$3:$J$3;0)).
In F2: =INDEX($L$2:$N$2;MATCH(D2;$L$3:$N$3;0)). If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the subject field. Select the green checkmark icon at the same time.
[Tutorial] VLOOKUP questions and answers
[Tutorial] Ten concepts that every Calc user should know
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).