![](http://navigatingstem.com/wp-content/uploads/2022/01/Excel-Basics-for-Chemistry-and-Biology-Classes-2-768x1024.png)
Lines graphically illustrate linear functions, which are stated in slope-intercept form as:
y=mx+b
To calculate the line and slope for our data in excel we need to first make a plot.
We are going to use example data that is plant height in centimeters for each day in a week.
![](http://navigatingstem.com/wp-content/uploads/2022/01/image-1.png)
We have our data entered into excel in columns. In Column A we have “Days” which will be our x-axis in the plot. In Column B we have “Plant Height (cm)”, this will be our y-axis in the plot.
![](http://navigatingstem.com/wp-content/uploads/2022/01/image-2-1024x407.png)
To create a plot, we first need to select the data to be in the plot.
![](http://navigatingstem.com/wp-content/uploads/2022/01/image-3-1024x625.png)
To create the plot, we need to navigate to “Insert” shown at the top. In this menu, there will be multiple chart types you can choose from. We will be using a Scatter plot for this tutorial (shown highlighted in the above image).
![](http://navigatingstem.com/wp-content/uploads/2022/01/image-4-1024x441.png)
After selecting the Scatter plot, we will see our data plotted in a graph. You can change the title by selecting the text and typing an appropriate title.
![](http://navigatingstem.com/wp-content/uploads/2022/01/image-5-1024x406.png)
Next, we will add a trendline for our data. You will click on one of the data points and three options will appear to the right. The trendline option will appear when the “+” image is selected. Check the “Trendline” option to add a trendline that fits the data plotted.
![](http://navigatingstem.com/wp-content/uploads/2022/01/image-6-1024x372.png)
After plotting the trendline, we would like to determine the line equation and R-squared. By clicking the black triangle, you will be given a drop down menu. Clicking “more options” will bring up a menu to the right of the screen.
![](http://navigatingstem.com/wp-content/uploads/2022/01/image-7.png)
This menu will appear after selecting “More options.” To show the equation and R-squared value, check the two boxes for “Display Equation on chart” and “Display R-squared value on chart.”
![](http://navigatingstem.com/wp-content/uploads/2022/01/image-8-1024x426.png)
Now the equation will be shown on your chart in the form of y=mx+b. In this case, our slope is 0.0896 and our R-squared value is 0.9837.