# How to Solve Differential Equation in Excel (With Easy Steps)

Get FREE Advanced Excel Exercises with Solutions!

Microsoft Excel is a powerful tool that can perform different mathematical operations. In this article, we will learn to solve a differential equation in Excel. A differential equation defines the relationship between one or more functions and their derivatives. Today, we will show step-by-step procedures to solve a differential equation in Excel. Using these steps, you can easily solve any differential equation in Excel. So, without any delay, letâ€™s start the discussion.

## What Is a Differential Equation?

A differential equation is an equation that contains one or more functions and the derivatives of one variable with respect to another variable. The differential equation can be written as:

`dy/dx=f(x)`

We have different order differential equations. The highest order of the derivative is called the order of the differential equation. Differential equations are mainly used to calculate growth and decay over time. Also, these equations are used to create different models. We can also see a huge application of differential equations in the field of physics.

## How to Solve Differential Equation in Excel: With Easy Steps

Today, we will demonstrate the procedures to solve a first-order differential equation using Eulerâ€™s method in Excel. Letâ€™s take a look at the question we will be solving today.

Suppose, we have a differential equation dy/dt+y=t and an initial value y(0)=0.5. So, the equation can be written as dy/dt = t-y. We need to compute the yâ€“values in a time interval (0,1.2). Letâ€™s follow the steps below to see how we can solve the differential equation.

### STEP 1: Create Dataset

• Firstly, we need to create a dataset to insert the iteration number (n), time value (t), y value, yâ€“exact value, and delta_t.
• The delta_t is the separation value.
• Also, you can display the equations to find the t(n+1) and y(n+1) values. We will implement these equations in the following sections.
• We have also added the time interval and initial value to make the calculation easy.

### STEP 2: Apply Formula for Time Values & Y-values

• Secondly, we will apply formulas to calculate the time values and y-values.
• At the start of the iteration, n is 0, t is 0, and y is 5.
• Now, insert these values in Cells B5, C5, and D5Â respectively.

• After that, we will insert a formula to calculate the t-values.
• To do so, select Cell C6 and type the formula below:
`=C5+\$G\$5`
• Press Enter.

• In the following step, we will find the y-values.
• So, select Cell D6 and type the formula below:
`=D5+(C5-D5)*\$G\$5`
• Press Enter to see the result.

### STEP 3: Fill Columns

• In the third step, we will fill the values with the n, t, and yÂ columns.
• Firstly, we will fill the iteration number (n) column.
• To find the number of iterations, we need to divide the time interval by the delta_t value.
• In our case, iteration number (n) = (2/0.1) = 12.
• So, we need to fill the iteration column from 0 to 12.

• After that, select both Cells C6 & D6 and drag the Fill HandleÂ down.

• Finally, you will get all the t and yâ€“values.

### STEP 4: Plot Data

• At this moment, we need to plot the t and yâ€“values.
• For that purpose, select the range C4:D17.

• After that, go to the Insert tab and click on the Insert Scatter icon. A drop-down menu will appear.
• Select Scatter with Lines from there.

• As a result, you will see a chart on the sheet.
• You can change the chart title according to your preferences.

### STEP 5: Format Axis

• In step 5, we will format the axis of the graph.
• To do so, doubleâ€“click on the horizontal axis. It will open the Format Axis options on the right side of the sheet.
• Set the Minimum value to 0 and Maximum value to 1.2 in the Bounds section, and press Enter to proceed.

• Similarly, doubleâ€“click on the vertical axis.
• Then, set the Minimum value to 0.3 and Maximum value to 0.65 in the Bounds section, and press Enter to proceed.

• As a result, the graph will look like the picture below.

### STEP 6: Find the Exact Solution

• Now, we will calculate the exact solution of the differential equation and match it with the numerical values.
• In our case, the exact solution of the differential equation is y = -1 + t + 1.5*exp(-t).
• So, select Cell E5 and type the formula below:
`=-1+C5+1.5*EXP(-C5)`

• After that, press Enter and drag the Fill HandleÂ down.

• Finally, you will know the y-values of the exact solution.

### STEP 7: Plot the Exact Solution on the Same Chart

• To compare the y-values of the exact solution with the numerical values, we need to plot them on the same chart.
• To do so, rightâ€“click on the chart to open the menu.
• Click on the Select DataÂ option.

• In the Select Data Source dialog box, click on Add.

• Now, insert the Series X and Y values in the Edit SeriesÂ box.

• Finally, click OK to get the plot of the exact solution.

### Final Output

• Finally, if we change the delta_t value in Cell G5, then the whole dataset will automatically update and show the solution for the updated delta_tÂ value.

• Furthermore, the graphs will also update automatically.

## Related Articles

<< Go Back to Excel Solve Equation | Excel Solver ExamplesÂ |Â Solver in ExcelÂ |Â Learn Excel

## What is ExcelDemy?

ExcelDemy - Learn Excel & Get Excel Solutions Center provides online Excel training , Excel consultancy services , free Excel tutorials, free support , and free Excel Templates for Excel professionals and businesses. Feel free to contact us with your Excel problems.
Mursalin Ibne Salehin

Mursalin Ibne Salehin holds a BSc in Electrical and Electronics Engineering from Bangladesh University of Engineering and Technology. Over the past 2 years, he has actively contributed to the ExcelDemy project, where he authored over 150 articles. He has also led a team with content development works. Currently, he is working as a Reviewer in the ExcelDemy Project. He likes using and learning about Microsoft Office, especially Excel. He is interested in data analysis with Excel, machine learning,... Read Full Bio

We will be happy to hear your thoughts

Advanced Excel Exercises with Solutions PDF