More problems using an IF statement.

D

Dark Horse

Just when I think I'm as finished as I can be, along comes some research
that makes me need to change what I thought I'd just finished.
Such is life, but I now have a new problem because a variable now becomes
dependent upon two conditions where previously only one applied.

I had column P which records the figure 2 or the figure 3 which is directly
input.
I have now inserted column Q which asks for either a letter C or a letter F.

I had column X which asked what value was in P2 and gave a resulting
instruction as to what to enter in X2.
I have now created column Y, which needs to amend X2 as a result of what is
in Q2.
What is the best way to go about this?
My original thought of saying IF(Q2=F,X2=X2-50,X2=X2) doesn't seem to work,
so it obviously needs more of a brain than I possess to know how to go about
this problem.

To sum up.
As a result of what is in cells P2 and Q2, cell X2 can contain four possible
entries:
if P2 = F and Q2 = 2 then X2 needs to contain 950
if P2 = C and Q2 = 2 then X2 needs to contain 1000
if P2 = F and Q2 = 3 then X2 needs to contain 1050
if P2 = C and Q2 = 3 then X2 needs to contain 1100

Is there any other, perhaps better, method of getting the result I need?

Thanks
Dave
 
P

Paul

Dark Horse said:
Just when I think I'm as finished as I can be, along comes some research
that makes me need to change what I thought I'd just finished.
Such is life, but I now have a new problem because a variable now becomes
dependent upon two conditions where previously only one applied.

I had column P which records the figure 2 or the figure 3 which is directly
input.
I have now inserted column Q which asks for either a letter C or a letter F.

I had column X which asked what value was in P2 and gave a resulting
instruction as to what to enter in X2.
I have now created column Y, which needs to amend X2 as a result of what is
in Q2.
What is the best way to go about this?
My original thought of saying IF(Q2=F,X2=X2-50,X2=X2) doesn't seem to work,
so it obviously needs more of a brain than I possess to know how to go about
this problem.

To sum up.
As a result of what is in cells P2 and Q2, cell X2 can contain four possible
entries:
if P2 = F and Q2 = 2 then X2 needs to contain 950
if P2 = C and Q2 = 2 then X2 needs to contain 1000
if P2 = F and Q2 = 3 then X2 needs to contain 1050
if P2 = C and Q2 = 3 then X2 needs to contain 1100

Is there any other, perhaps better, method of getting the result I need?

Thanks
Dave

You seem to be muddling which cell is P2 and which is Q2. Are you are
keeping column X as it was? If so, do you want a formula for Y2 so that its
result will be either X2 or 50 less than X2 depending on whether you have
the letter "F" in Q2? If so, in Y2 you need:
=IF(Q2="F",X2-50,X2)
 
R

Ron Rosenfeld

Just when I think I'm as finished as I can be, along comes some research
that makes me need to change what I thought I'd just finished.
Such is life, but I now have a new problem because a variable now becomes
dependent upon two conditions where previously only one applied.

I had column P which records the figure 2 or the figure 3 which is directly
input.
I have now inserted column Q which asks for either a letter C or a letter F.

I had column X which asked what value was in P2 and gave a resulting
instruction as to what to enter in X2.
I have now created column Y, which needs to amend X2 as a result of what is
in Q2.
What is the best way to go about this?
My original thought of saying IF(Q2=F,X2=X2-50,X2=X2) doesn't seem to work,
so it obviously needs more of a brain than I possess to know how to go about
this problem.

To sum up.
As a result of what is in cells P2 and Q2, cell X2 can contain four possible
entries:
if P2 = F and Q2 = 2 then X2 needs to contain 950
if P2 = C and Q2 = 2 then X2 needs to contain 1000
if P2 = F and Q2 = 3 then X2 needs to contain 1050
if P2 = C and Q2 = 3 then X2 needs to contain 1100

Is there any other, perhaps better, method of getting the result I need?

Well, your formula IF(Q2=F,X2=X2-50,X2=X2) won't work because an IF statement
cannot modify another cell. So that formula entered in Y2 will merely return a
TRUE or FALSE in Y2. It cannot modify X2.

One formula that would do what you state above would be, entered in X2:

=950+50*(P2="C")+100*(Q2=3)


--ron
 
D

Dark Horse

To reiterate:
I was getting muddled wasn't I?
I am keeping X as it was, as the variable there will be used by other cells
To sum up.
As a result of what is in cells P2 and Q2, cell X2 can contain four possible
entries:
if P2 = 2 and Q2 = C then X2 needs to contain 950
if P2 = 3 and Q2 = F then X2 needs to contain 1000
if P2 = 2 and Q2 = C then X2 needs to contain 1050
if P2 = 3 and Q2 = F then X2 needs to contain 1100

And finally, your method worked like a charm, many thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top