David Poiron Posted September 14, 2021 Share Posted September 14, 2021 Is there a way to get nested If/Then statements to work in a worksheet cell? I'm trying to replicate the functionality of a case statement that other programs have, to query more than one option. Quote Link to comment
michaelk Posted September 14, 2021 Share Posted September 14, 2021 If you mean in the data header, then yes: =IF( <logic test>, result 1, IF(<another logic test>,another result,IF(<different logic test>,different result, last result))) In the syntax of IF THEN ELSE the then or the else can be another IF/THEN/ELSE. This example shows the nested IF/THEN/ELSE in the ELSE part. It becomes a tsunami of parenthesis, so be careful 🙂. If you mean inside a normal cell, then I'm less certain. Do you have an example? Quote Link to comment
Pat Stanford Posted September 14, 2021 Share Posted September 14, 2021 It would work the same way inside a conventional spreadsheet cell. You would just specify the IF condition differently. =IF(A1='Michael', 'Nice Guy', If(B1='Pat', 'Trashy Guy', 'Guy Unknown')) 1 Quote Link to comment
Pat Stanford Posted September 14, 2021 Share Posted September 14, 2021 Remember Michael, my day job is treating landfill leach (ie the trash juice you get when you put wet stuff (and rain) into a dump. Can you think of a better way to describe what I do than being a trashy guy? Quote Link to comment
David Poiron Posted September 14, 2021 Author Share Posted September 14, 2021 That is what I thought. I did try again and it worked - I must have forgotten a parenthesis or something. Thanks to both of you. Quote Link to comment
michaelk Posted September 14, 2021 Share Posted September 14, 2021 @Pat Stanfordwet trashy? Quote Link to comment
Pat Stanford Posted September 14, 2021 Share Posted September 14, 2021 Yep, wet trashy me. 😉 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.