Solve a equation with x in the second power

This is a discussion on Solve a equation with x in the second power within the Excel Questions forums, part of the Question Forums category; ...

1. Solve a equation with x in the second power

Hello

Need help solving x out of this kind of equation:

x^2*234+x*123+2345=0

Any idea if I can use a simple command in excel to solve this, have looked over the normal fx statements and canīt find any solvers.

Regards
Atli F.

2. If you just want to use basic Excel functions without loops, your equation would look something like this :-
Code:
`=(A4*A4)*234+(A4*123)+2345`
where A4 is the cell ref that contains your original number
Goal Seek may also be useful but would need a loop in VBA. Something like
Code:
```while range("B4")<>0
Range("B4").GoalSeek Goal:=0, ChangingCell:=Range("A4")
wend```
But that could take some thime as it will loop until you get an answer of zero (which could take forever!)

If you just want to use basic Excel functions without loops, your equation would look something like this :-
Code:
`=(A4*A4)*234+(A4*123)+2345`
This isnīt the code Iīm looking for since Iīm looking for the value of A4 (donīt know it and want excel to calculate it for me)

I just installed solver add on but canīt for the life of me figure it out, any help on that and the equation would be great.

P.s. Iīm hoping I donīt have to resolve to VB

Than

4. This is a simple quadratic. A4 will have two solutions, which can be calculated as:
=(-123+SQRT((123)^2-(4*234*2345)))/(2*234)
and:
=(-123-SQRT((123)^2-(4*234*2345)))/(2*234)

Any quadratic of the form ax^2+bx+c=0 has the following two solutions:
=(-b+SQRT((b)^2-(4*a*c)))/(2*a)
and:
=(-b-SQRT((b)^2-(4*a*c)))/(2*a)

This is basic maths. If Excel returns an error, it is because the roots (ie, the solutions) are imaginary. Google "quadratic equation" for more info.

5. Just tried it in Solver and it isn't working for me either - looks like it will have to be VBA and a long wait unless anyone else has any other ideas.....

6. Import these two functions into your workbook:

Code:
```Public Function QuadSolvePlus(a, b, c As Double)

QuadSolvePlus = (-b + Sqr(b ^ 2 - (4 * a * c))) / (2 * a)

End Function

Public Function QuadSolveMinus(a, b, c As Double)

QuadSolveMinus = (-b - Sqr(b ^ 2 - (4 * a * c))) / (2 * a)

End Function```

You can now put the formula =QuadSolvePlus(A,B,C) into A4 and it will return x. Note two quirks of quadratic equations: first, many have non-real solutions (ie, contain a multiple of the square root of -1) and some have convergent roots (ie., QuadSolvePlus and QuadSolveMinus give the same solution for x.

7. Sibbles, you are unable to get an answer on your equation from Excel because the solutions to your equation are non-real. Try this link:
http://id.mind.net/~zona/mmts/miscel...ealSolver.html

8. Loose Cannon's (first post) formulas should work but, if you are trying to solve different equations with different coefficients, the the coefficients would need to be in different cells and his(?) formulas would need a, b, and c replaced by cell references. Note, too that the last formula given by Loose Cannon I think should start =(-b-SQRT...

We can use Goal Seek, but note that only approximate solutions will be obtained and only 1 solution when there might actually be two. Let's take a simpler quadratic equation to start with. X^2 + x - 6 = 0 This has solutions of 2 and -3. To get Goal Seek to find a solution, put this formula in B1:
=A1^2+A1-6
Now go Tools|Goal Seek|Set Cell B1|To Value 0|By changing cell A1|Ok
An (approximate) solution to the equation should appear in cell A1.

Here is my result:

******** ******************** ************************************************************************>
 Microsoft Excel - Mr Excel.xls ___Running: xl2002 XP : OS = Windows XP
 (F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)bout
 B1 =

A
B
C
D
1
21.5911E-05
2
 Equation

[HtmlMaker 2.42] To see the formula in the cells just click on the cells hyperlink or click the Name box
PLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR.

9. Good pick-up Peter - typing too fast for my own good! Will edit that now.

10. Thanks Loose Canon and Peter

I knew the abc formula for calculating out the formula, just wondering if excel has a simular functuion as my calculator (Casio fx9750 Plus) that solves the formula if you enter it in the same fashion as in my first post, guess I will have to make excel calculate the abc formula manually, as in your posts.

Thanks alot for those formulas, this forum is really a neccessity when using excel.

P.s. Will let you know my final formula and the result I will get from it

Regards
Atli F.

Page 1 of 2 12 Last

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•