MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

If and loop

  Asked By: Pamela    Date: Nov 25    Category: MS Office    Views: 678

I have the following Formula in cell D38 = B29*((B31-G34))22

What is the value of G34 So that the formula (D38) =0

Always Values in Cell B29, B31, G34 > 0



8 Answers Found

Answer #1    Answered By: Ana Bradley     Answered On: Nov 25

I'm not sure what your precise formula  is, as there is a "2" at the end of
it and another "2" in a line by itself. Can I assume that those "2"s
shouldn't be there?

If so, this sounds like homework and like simple Algebra not Excel.
Therefore I won't supply the answer directly.

However, the formula appears to be a simple multiplication. To get the
result of a multiplication to be zero, then either or both sides of the
multiplication symbol must equal zero. You've said that B29 is not zero, so
... over to you.

Answer #2    Answered By: Bernard Gutierrez     Answered On: Nov 25

Formula should read D38 = (B29*((B31-G34))**2)/2

Values in Cell B29, B31, G34 > 0
Regarding If then loop

I mean If range("D38").value <> 0 then ?


Answer #3    Answered By: Vilhelm Fischer     Answered On: Nov 25

The formula  you have given is not valid. Put the formula into a cell  in excel
and make sure it is valid, then ask us a question based on the real formula.

Hint - if you are doing programming in a language other than Excel VBA ask the
question on a forum for the language you are using. ** is not a valid
operator in excel.

Answer #4    Answered By: Kyle Fox     Answered On: Nov 25

I am terribly Sorry, you are right regarding ** it should be ^ the formula
should read as :

D38 = (B29*((B31-G34)) ^2)/2

Answer #5    Answered By: Leonard Pierce     Answered On: Nov 25

OK. So we know B31-G34 has to be 0 so what will G34 be to make that happen?

Answer #6    Answered By: Elisabeth Bell     Answered On: Nov 25

Only when B31=G34............................

Answer #7    Answered By: Midissia Lopez     Answered On: Nov 25

Sorry, now I'm totally mystified.

Firstly, it sounds as though you are expecting to have a formula  that
actually reads D38 = (B29*((B31-G34))**2)/2

Excel formulas do not have anything to the left of the equals sign. So, in
cell D38 you could have a formula =(B29*((B31-G34))**2)/2.

Well, you couldn't really, because ** is not an Excel operator. But you
could have =(B29*((B31-G34))*2)/2

Now that calculates a value to go into the cell  it's in, which might be D38,
or wherever you've put it.

What is an "If then loop"? An "If then" is a statement; a "loop" is an
entirely different statement. Additionally, Excel formulas do not have
loops; and they don't strictly have "If then", although they do have calls
to an IF function.

And what does "If range("D38").value <> 0 then ?" mean? For starters, that
is not a formula, it is part of a VBA statement.

As I indicated earlier, if you want to use a formula like the above to
produce a value of zero, then one side or other of the first multiplication
operator must be zero. This is Algebra, not Excel.

Answer #8    Answered By: Sebastien Anderson     Answered On: Nov 25

Just picked up on this thread.

The answer is very simple. Use GoalSeek with target cell  = D38, value =
0, cell to change = G34.

And if you want to do this in VBA, just record your steps, and then you
can automate it.

Didn't find what you were looking for? Find more on If and loop Or get search suggestion and latest updates.