How to Solve an Equation in Excel

This week at the Chandoo,org Forums, Usman asked,

“ I have a curve. I did its fitting using Excel and got an equation.

y = 2E+07x^-2.146

For y=60 what will be the value of x?

How can we solve this equation using Excel? ”

Lets look at how this can be solved using Excel.

Define the Problem

Usman formula is y = 2E+07x^-2.146

or expanded y = 2*10^7*x^-2.146

We can use Excel’s Goal Seek function to assist us here

Goal Seek is located in the Data, What-If Analysis, Goal Seek menu

GS00

Goal Seek is an inbuilt function in Excel that searches for a solution to a model/formula by iteratively trying source cell values until a solution is found.

Before we start, Excel doesn’t understand the concepts of x and y, but we can use cells for these instead

To use Goal Seek we need to put our formula into a cell.

Start a new file and in C3 (our y cell) type:  = 2*10^7*B3^-2.146

In B3 (our x cell): Put a value say 10

GS02

Note that C3 will show the solution of the formula for when x=10 or = 2*10^7*10^-2.146 = 142,899.277

GS01

 

Using Goal Seek

To use Goal Seek to find what value of x (B3) will result in y (C3) = 60,

Select C3

Goto the Data, What-If Analysis, Goal Seek menu

GS03

Set Cell: C3  – This is our y value cell

To value: 60  This is the value we want to achieve

By changing cell: B3 – This is our x value cell

Click OK when ready

GS04

Excel shows us that it has found a solution and that y (C3) =60 when x (B3) = 374.60

Select OK to save the result

Select Cancel to return to the previous value

You can download a sample of the above here: Download Sample File

 

How have you solved Formulas using Excel or other techniques

How have you solved Formulas using Excel or other techniques?

Let us know in the comments below:

Learn more about Goal seek and solver:

 

 

Facebook
Twitter
LinkedIn

Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Overall I learned a lot and I thought you did a great job of explaining how to do things. This will definitely elevate my reporting in the future.
Rebekah S
Reporting Analyst
Excel formula list - 100+ examples and howto guide for you

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Advanced Pivot Table tricks

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

31 Responses

  1. I’ve used goal seek to solve equations, but it is not very useful when there are several possible solutions and one needs them all. I also have used trendlines in charts to find the equation for the line of best fit. Not quite the same as solving equations, but easier than running linear regressions to find the same result.

  2. Yes! I have solved a variety of equations using various techniques. The one I like to demonstrate, though, is the solution of relatively complexsimultaneous equations using

    =MINVERSE() and =MMULT() functions

    I also solve simultaneous equations in a work sheet using the substitution method as it is direct and easy to program!

  3. I tried two alternative approaches:

    first, good old algebra (my kids are doing a lot of expression rearranging at school just now)…

    So x = (y / 2*10E+07) ^ (-1/2.146)

    second, I’ve been playing with a little program called “Calca” (http://calca.io). It’s a little hard to describe (but only costs $9.99 to try) but think of a text document that understands math and recalculates on the fly. Something like that. So I start by typing:

    y = 2*10^7*x^-2.146

    which let’s me use the “evaluate” operator, “=>”. I type “x =>” (without the quotes) and calca adds what it knows:

    x => 2524.3961/y^0.466

    .. so it restates the expression in terms of y. Pretty cool. For a solution, I typed

    60 = 2*10^7*x^-2.146

    and then asked for x:

    x=> 374.6009

    It’s a fun little program. The Windows version is only semi-officially available and there’s no obvious link on the site, but I found it here: http://calca.io/store

    1. This.

      While I appreciate the craftiness of teaching to use Excel’s Goal Seek function to solve an equation, I find it somewhat dangerous. I’m aware that the question explicitly asked to use Excel for this, but I would liken the answer to teaching a hungry man to fish — with dynamite!

      If you need to do algebra but have trouble dealing with formulas, you should try to polish up your algebra, ask someone who does, or use a software package like suggested above. When you are handling algebraic formulas by applying tricks and hacks, you are bound to make mistakes which will bite you later.

      So, how do you arrive at a solution by using school algebra?

      The goal is to have x standing on one side, and the rest on the other side.

      Starting with
      y = 2*10^7*x^-2.146,
      you can move the factor “2*10^7” to the left by dividing by 2*10^2:
      y/(2*10^7) = (2*10^7*x^-2.146)/(2*10^7)
      y/(2*10^7) = x^-2.146
      The next step is a little trickier. You need to get rid of the exponent “-2.146” on the right side. If the exponent were “2”, we know that we could simply extract the square root. Analogously, in our case, we would need to extract the “-2.146″th root. But there’s no function to extract an arbitrary root. We need to know that, in the example of square roots, “extracting the square root of a value” is the same as “raising the value to 1/2”. In short, sqrt(4)=4^(1/2). Correspondingly, “extracting the ‘-2.146’th root” is the same as raising to “1/-2.146”, which is the same as -1/2.146. That’s what we need to do to get rid of the exponent on the right side:
      (y/(2*10^7))^(-1/2.146) = (x^-2.146)^(-1/2.146)
      (y/(2*10^7))^(-1/2.146) = x
      Swap left and right sides and we get:
      x = (y/(2*10^7))^(-1/2.146)

  4. I heard of this function but never tried it before, but this simple explanation give me more thought about it, i will dig into it further & learn more your other related posts. thanks so much. chandoo…

  5. I learned how to solve simultaneous equations in Excel from Alan Beban’s posts many years ago using MINVERSE and MMULT (same thing Duncan is describing). I have actually used it a few time in my work.

  6. used the goal seek function to solve for equation
    a= CF*1/(1+x)^1+CF*1/(1+x)^2+…….+CF*1/(1+x)^n for a changing ‘a’.
    Quite clean and helpful.
    Thanks !

  7. I need to create a function with regular addition and subtraction of digits to/from a variable, say “x”. as I type x in the cell i get result as “#value!” instead of “x-2” . What should i do?

      1. This is probably a formatting error where Excel thinks a number is a text character. If you post an example of your work it will help us to help you

  8. I have replied to Rahul off list but have not had a response as yet.

    I accept that Rahul could have uploaded his work here but since he didn’t, all’s still well I think.

    I have to wait for Rahul to reply otherwise anything I say might be pointless … and not the answer to his question!

      1. Rahul and I are still chatting. I think the problem is solved but I am waiting for Rahul’s final say so.

  9. Hi,

    I have a table in excel. I have a total sum with 6 countries and % each of these countries represent of the whole. Also within same table I have 5 segments with percent of of segment as a whole and then percent by each country with breakdown % allocated by segment. I know the total value and I am trying to populate table so values tie out on coulmns to equal country sum and then on rows to sum to segment sum. Not sure if this makes sense but been struggling for hours with this!!! Help please

  10. how i find x and y value in the following equation by use of excel

    x+y =136.96
    28x/100+18y/100 =16
    then what is the value of x and y
    how it find

  11. how i find x and y value in the following equation by use of excel

    x+y =120.56
    28x/100+18y/100 =32.4
    then what is the value of x and y
    how it find

    1. @Jithin

      This is a simultaneous equation

      I would solve this manually like:

      (1) x+y =120.56
      (2) 28x/100+18y/100 =32.4

      (3) = (1) x 18/100
      = 18x/100 +18y/100 = 18*120.56/100
      = 18x/100 +18y/100 = 21.7008

      (4) = (2) – (3)
      28x/100+18y/100 =32.4
      – 18x/100 +18y/100 = 21.7008
      = 10x/100 + 0 = 32.4 – 21.7008
      = x/10 = 10.6992

      (5) Multiply both sides by 10
      x = 106.992

      (6) Substitute x into (1)
      x+y =120.56
      106.992 + y = 120.56
      y = 120.56 – 106.992
      y = 13.568

      Enjoy

  12. Thanks so much for your response to my inquiry, but I will appreciate a further detailed information in a vivid description.

  13. i just want to put a formula like below:

    Ex. 1
    time- 2:30
    formula want to make : =2+30/60

    Ex 2
    Time – 0.30
    formula : =0+30/60

    Help me if possible

  14. Emp. MONTH Date BEAT NAME DISTR-NAME
    xyz jan 1-1-2022 LEAVE LEAVE

    entire year record is here in excel .
    suggest formula for each Employee every month how many leaves are there???

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.