If statement help

leedalton

New Member
Joined
Apr 18, 2011
Messages
10
This is probably a very simple fix but I cannot figure it out.
I need an if statement that allows me to do the following:
In cell A1 I put the person's gender, either an M or an F.
Then in Cell A2 I want an if statement that will refer the cell A2 to a formula in another cell. For example cell A5.
A1 A2 A5
M If Cell A1 = M then execute the formula in cell A5 =vlookup...
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Code:
=if(A1="M",A5,"ELSE")

This will return the result of the formula in A5, if A1=M.
Replace "ELSE" with whatever you want to do if A1 is NOT = M.
 
Upvote 0
I should have been more clear.
I need the formula to be able to do this
if A1 = M then execute Cell A5 or if a1=F then execute Cell a6
I can't figure it out.
 
Upvote 0
If you have formulas in A5 and A6, then they are going to be executed whatever happens.

If you then want A2 to select the result from either A5 orA6, try
Code:
=if(A1="M",A5,A6)
 
Upvote 0
That is not what I need to do. I want to be able to put either an M or an F in A1 and then have A2 execute a formula based off the input in A1.

For example
if A1=M then execute formula in cell A5 but if A1=F then execute formula in A6
 
Upvote 0
In that case I don't understand.

Are you saying that if A1=M, you want to NOT execute the formula in A6 ?
That isn't really possible - see my first comment in post #5.

What you can do, is make the result of teh formula in A6 be blank, or 0, or something else, if A1=M.

For example, let's say your formula in A6 is
Code:
=2+2

You can adapt this to
Code:
=if(a1="F",2+2,"")

This will return the result of 2+2 if a1 = F. And if A1 is not = F, it will return a blank.
Is this what you mean ?
 
Upvote 0

Forum statistics

Threads
1,224,508
Messages
6,179,188
Members
452,893
Latest member
denay

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