2010 if/and/ or nested

iksotof
3StarLounger
Posts: 315
Joined: 04 May 2010, 15:18

2010 if/and/ or nested

Post by iksotof »

Hello, having been absent from this stuff for a few years and I am back to basics, so apologies for this! No less I am struggling with a combination of if/or/and statements. I have a cell, say A1 that I want to return values based on 3 possible values from say cell B2. So say B2 = X then A1 = A, B2=Y then A1=B and if B2 = Y then A1 = 3. Assistance is warmly welcomed.

Thank you.

User avatar
HansV
Administrator
Posts: 78500
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: 2010 if/and/ or nested

Post by HansV »

If B2=Y, A1 can't be B and 3 at the same time.

Perhaps you meant something like

=IF(B2="X","A",IF(B2="Y","B",IF(B2="Z",3,"")))

But if you have a large number of values, it's easier to create a lookup table and use the VLOOKUP function.
Best wishes,
Hans