# IF AND Formula help

#### herpasymplex10

##### Board Regular
I think this is possible, but i could be wrong.
I've got a formula

=IF(AND(F2="F",D2="PAP"),L2,"")

What i'd like is for the formula to look at just the last letter of the three letter code in D2

### Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

#### Jonmo1

##### MrExcel MVP
=IF(AND(F2="F",RIGHT(D2,1)="P"),L2,"")

Hope that helps..

#### MrKowz

##### Well-known Member
Try this out:

=IF(AND(F2="F",right(D2,1)="P"),L2,"")

Basically, this will say if the value in F2 = "F" and the last letter in D2 = P, then it will return the value in L2... otherwise it will remain blank.

Jonmo1 beat me to it!

Deleted

#### herpasymplex10

##### Board Regular
thanks for such quick replies
unfortunately i jumped the gun on my post

I need it to look at the last two letters from D2
if they are "AP" then return the value of L2

I appreciate the help
i'm sick and my mind is not working today

would it be this?

right(D2,2)="AP"

Last edited:

#### MrKowz

##### Well-known Member
=IF(AND(F2="F",right(D2,2)="AP"),L2,"")

#### herpasymplex10

##### Board Regular
again. i spoke to soon
i'm having trouble adding an OR statement to the formula
F2 could be either "F" or "M"
for the statement to be true
help?

#### MrKowz

##### Well-known Member
=IF(AND(OR(F2="F",F2="M"),right(D2,2)="AP"),L2,"")

#### herpasymplex10

##### Board Regular
=IF(AND(OR(F2="F",F2="M"),right(D2,2)="AP"),L2,"")

I really appreciate the help.

Replies
3
Views
619
Replies
9
Views
344
Replies
5
Views
895
Replies
1
Views
327
Replies
8
Views
366

1,191,117
Messages
5,984,741
Members
439,906
Latest member
Sekiro1899

### 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.

### Which adblocker are you using?

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

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