Excel If Statements, please help!

I

izzie

I've been trying to make multiple IF statements but it says that I hav
too many arguements. The problem is, I need to have a calculation fo
my work.

Here's what I need to be done

For example:

If G7 is changed, then M7 needs to change to what G7 is times 0.5

Then, if G10 is changed M7 also needs to be changed. However, if M7 i
greater that zero this equation needs to be done M7+G7-M7*G7
If M7 is less than zero, this equation needs to be done M7+G7+M7*G7

Then, if G11 is changed, M7 also needs to be changed and the same rule
above apply.

Can anyone help me to do this please? I've been trying for ages and
can't find a solution.

Many thanks

Izzi
 
J

JE McGimpsey

I may be just being dim, but I think you'll have to provide more
information.

It sounds like your first example should just be to put

=G7/2

in M7. You then say the if G10 is changed, M7 needs to be changed, too,
but you describe a formula that uses M7 - so what exactly are you
wanting to be changed when G10 changes? To change M7, say, to

=M7+G7-M7*G7

you'll need to use an event macro (formulas can't change other formulas)
and you'll get a circular reference as well.

If you instead mean that G10 should change if M7 changes, you could use

G10: =M7+G7-G7*ABS(M7)

which, since M7 is just G7/2 means that you could use the equivalent:

G10: =G7*(1.5-ABS(G7/2))
 
I

izzie

JE said:
I may be just being dim, but I think you'll have to provide more
information.

It sounds like your first example should just be to put

=G7/2

in M7. You then say the if G10 is changed, M7 needs to be changed,
too,
but you describe a formula that uses M7 - so what exactly are you
wanting to be changed when G10 changes? To change M7, say, to

=M7+G7-M7*G7

you'll need to use an event macro (formulas can't change other
formulas)
and you'll get a circular reference as well.

If you instead mean that G10 should change if M7 changes, you could
use

G10: =M7+G7-G7*ABS(M7)

which, since M7 is just G7/2 means that you could use the equivalent:

G10: =G7*(1.5-ABS(G7/2))


Yeah, sorry, I didn't explain myself properly. I do need M7 to change
once the other fields have been updated according to that equation. How
do I use an event macro?

Originally, what I did was this:

=IF(G10>0, M7+G10-M7*G10, M7+G10+M7*G10, IF(G11>0, M7+G11-M7*G11,
M7+G11+M7*G11, G7*0.5))

and it said I had to many arguments.
 
J

JE McGimpsey

I'm still not clear on what you're trying to accomplish.

What cell do you want this to go into? If M7, then do you really want
circular references if G10 or G11 <>0?

What should happen if *both* G10 and G11 are <>0?

The IF() function has the form

=IF(condition, TRUE branch, FALSE branch)

i.e., in =IF(G10>0, ..., ...), G10 is either >0 or it's not. Adding the
additional terms is why you got the error.
 
J

JR

You could still if statements, just use more cells so you don't get a
circular reference. It sounds like M7 could always be G7*1.5. In M8, put in
If(M7>0,M7," "), then have G10 refer to M8 and G11 refer to M9, etc.
 

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