Nested IF formula

zicitron

New Member
Joined
Apr 21, 2013
Messages
22
Hi all,

I'm using Excel 2013 and I need a nested formula in a column of my worksheet but I just can't get around the right syntax.
I need the formula to do the following:

IF G4 = "TOR" and Q4 = "TO", THEN "Correct", else "Wrong"
IF G4 = "DMCR" and Q4 = "DMC", THEN "Correct", else "Wrong"
IF G4 = "OTAR" AND Q4 = "OTA", THEN 'Correct', else "Wrong"

Thanks for helping!
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi all,

I'm using Excel 2013 and I need a nested formula in a column of my worksheet but I just can't get around the right syntax.
I need the formula to do the following:

IF G4 = "TOR" and Q4 = "TO", THEN "Correct", else "Wrong"
IF G4 = "DMCR" and Q4 = "DMC", THEN "Correct", else "Wrong"
IF G4 = "OTAR" AND Q4 = "OTA", THEN 'Correct', else "Wrong"

Thanks for helping!

Hi, would you consider this: =IF(LEFT(G4,LEN(G4)-1)=Q4,"CORRECT","Wrong") copied anywhere in your file.
Would that work for you?
 
Upvote 0
Thanks for your input, cyrilbrd. I do understand the logic behind your proposed formula but unfortunately it won't work as I have another option that I did not list: IF G4 = "DR" and Q4 = "DIR", then "Correct", else "Wrong". Didn't bother to list this one as I thought I would amend the proposed solution accordingly!
 
Upvote 0
Thanks for your input, cyrilbrd. I do understand the logic behind your proposed formula but unfortunately it won't work as I have another option that I did not list: IF G4 = "DR" and Q4 = "DIR", then "Correct", else "Wrong". Didn't bother to list this one as I thought I would amend the proposed solution accordingly!

=IF(AND(G4="DR",Q4="DIR"),"CORRECT",IF(LEFT(G4,LEN(G4)-1)=Q4,"CORRECT","Wrong"))
 
Upvote 0
Or =IF(Q4=INDEX({"dir","dmc","ota","to"},MATCH(G4,{"DR","DMCR","OTAR","TOR"},0)),"CORRECT","Wrong"))
Advantage of this would be the defined list of possible match.
Would that work for you?
 
Upvote 0

Forum statistics

Threads
1,216,475
Messages
6,130,847
Members
449,599
Latest member
blakecintx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top