Quadratic Equation Macro on Excel

you can easily solve a quadratic equation by just going to tools-macro-run macro.
I am a new member and really need any kind of feedback you can give.
Enjoy not using any paper solving these equations!

Step 1: Setting Things Up

open up excel any year is okay ( preferred 03 thats what I used to make this macro). If you are using excel 07 it will be under view and there will be a little box that says macro. Click the icon and go to record macro a window will appear it will setup the name and descriptions of the macro. After you do that click on the macro icon again and a another window will appear there should be in the window the name of the macro there(default name will be Macro1)

Step 2: Making the Macro

Okay now you go to edit on the window that has came up it should be on the right hand side third down. When you press the edit button a whole new window will appear called visual basic editor. There should be a toolbar and everything like any window, but in the window there should be a big gray area with a window called Module1(Code). Inside the the Module1 click as you were going to type on it and copy and paste this on it(make sue you delete everything before you do this on the Module1 box.)
Sub QuadraticFormula()
Dim a As Long
Dim b As Long
Dim c As Long
MsgBox prompt:="ax2 + bx + c = 0", _
Title:="Solving a Quadratic Polynomial of the Form:"
a = Application.InputBox(prompt:="Enter the value of the 'a' coefficient", Type:=1)
b = Application.InputBox(prompt:="Enter the value of the 'b' coefficient", Type:=1)
c = Application.InputBox(prompt:="Enter the value of the 'c' coefficient", Type:=1)
If a = 0 Then
MsgBox "The equation is not quadratic"
If ((b * b) - (4 * a * c)) >= 0 Then
MsgBox ((-b + (Sqr((b * b) - (4 * a * c)))) / (2 * a))
MsgBox ((-b - (Sqr((b * b) - (4 * a * c)))) / (2 * a))
MsgBox "No Real Solution - Imaginary"
End If
End If
End Sub

Step 3: Finishing Up

When that window has everything I told you to copy and paste close the VIsual Basic Editor. Finally go to macro-view macros then go to run on the right hand side the first one. There should be a window that pops up click OK then another box will appear that will be the value of A in the equation then another that will be the value of B in the equation and then another that will be the value of C. Your done if you have a problem please tell me and please leave me some sort of feedback.



    • Toys Contest

      Toys Contest
    • Comfort Food Challenge

      Comfort Food Challenge
    • Cardboard Challenge

      Cardboard Challenge

    2 Discussions


    9 years ago

    Hey, this is a great instructable and is very informative. Just one thing is missing... pictures! It really helps a lot when trying to follow directions so you should consider taking some photographs. Once you do that and leave me a message when you have so that we can publish your work. Thanks! Thanks for the cool instructable and we hope to publish this soon!


    3 years ago on Introduction

    It does not like numbers less than 1? e.g. -0.0012t2+0.08t