How to Perform Machine Learning in Excel (With Easy Steps)

Many of us use Excel in our business organizations. In any business organization, we use Excel to organize data as needed and make databases for the future. Moreover, one interesting thing is that we can perform machine learning easily in Excel for better representation and operation. However, I have used Microsoft Office 365 for the purpose of demonstration, and you can use other versions according to your preferences. In this article, I will show you a step-by-step procedure to perform machine learning in Excel. Hence, read through the article to learn more and save time.


What Is Machine Learning in Excel?

Usually, the term “machine learning” refers to a subfield of artificial intelligence (AI), which deals with the methods that let machines pick up new skills. In addition, these algorithms are capable of learning from the examples we offer as practice data and they can forecast the future. Moreover, these algorithms help to predict changes in data. However, the best method for obtaining important data from unorganized data is machine learning. We can perform some basic algorithms in Microsoft Excel such as Regression Analysis. Excel can be used to preprocess the training dataset. After importing a dataset, you will need to check for blank values, categorical values,

Types of Machine Learning in Excel

You can perform various types of machine learning operations in Excel. Microsoft Excel is not built for the machine learning process, so there are many limitations. Often, you need to install add-ins to get the desired output.

  • Linear Regression:
    • You can do linear regression to create a machine-learning model. You can use this feature in Excel without installing additional add-ins. We will show you the steps of this in this article.
    • In general, regression analysis is a statistical process by which we can analyze the relationship between a dependent variable and an independent variable. However, the purpose of regression is to predict the nature of dependent variables with respect to corresponding independent variables. Moreover, it is an easy machine-learning algorithm.
  • Time Series Forecasting:
  • Cluster Analysis:
    • You can group similar values together on the basis of one or more input variables.
  • Decision Tree:
    • In Microsoft Excel, a decision tree is a visual aid for making an informed decision on given conditions. You can connect multiple conditions and their relevant decisions and draw a tree within the program. It allows the tree to change according to any change in data. It is mostly used in business forecasting, data analysis, C-level executives, and even in personal events. Using various charts and data a decision tree can be formed in Excel.
  • Image Recognition:
    • Excel can be used to recognize images. Excel add-ins written in Python are helpful for this.

Although Excel can do these types of operations, it should not be used for a large set of data.

Read More: How to Build Lottery Prediction Algorithm in Excel


How to Perform Machine Learning in Excel (With Easy Steps)

In this tutorial, I will show you how to perform machine learning and how the process becomes more interesting with Excel. However, the task is easy and straightforward. But you will need an arrangement in order to perform the operation properly. Here, I have used a step-by-step procedure to help you understand the scenario properly using linear regression analysis. Furthermore, there will be a chart that will help us visualize the predicted model.


Step 1: Prepare Training Data

For the purpose of demonstration, I have used the following sample dataset. Here, one column includes the salary of employees, and the other one includes the experience (years) of the employees of a company. In this process, I will find a machine-learning model chart and a modeled salary structure for the employees. Here, the dataset is preprocessed. If it is not, then you need to preprocess the data, which means – discarding missing data, encoding categorical data, etc.

Training dataset for the machine learning process

Read More: How to Perform Employee Scheduling Algorithm in Excel


Step 2: Select Model

In this section, I will enable the Data Analysis add-in for Excel. Then, I will perform the Regression Analysis with the training data to select a model for the machine learning process.

Data tab after enabling Data Analysis ToolPak

  • Secondly, the Data Analysis dialog box will appear. Now, select Regression and click OK.

Data Analysis dialog box

  • Thirdly, in the Regression window, insert the Y and X. As the salaries are dependent on experience, salary will be the Y values and experience will be the X values. For this reason, I put the salary range (B4:B14) and experience range (C4:C14) in the Input Y Range and Input X Range sections respectively.
  • Thereafter, make sure you check Line Fit Plots and Labels.
  • Now, I want the analysis data in the current, so I have selected B20 as the Output Range.
  • Finally, click OK.

Regression dialog box

  • Hence, you will see the regression analysis outcome in the current sheet. Moreover, you will also see there are some regression parameter values. I won’t be discussing the other values (coefficients, standard Error, t Stat, etc.) here.

Output of regression analysis

  • But most importantly, you will need the analysis data from the graph. Here, it plots both the Series Data (approximate salaries) and Predicted Data (salaries for modeling).
  • At last, give your graph a name if you want. However, I named this chart the Machine Learning Model.

Change Title for the Line Fit plot


Step 3: Predict Data

In this part, I will create a machine-learning model chart and a modeled salary structure for the employees. Here, the chart analyzes the given data and, in turn, provides a predicted trendline. However, I will generate a modeled salary structure using the predicted trendline equation.

  • Initially, right-click on any of the points on this chart and select Add Trendline.

Add Trendline to Chart

  • Now, the Format Trendline window will appear next.
  • Afterward, select Linear and check Display Equation on the Chart.

Format Trendline option

  • Thereafter, you will see the straight-line plot along with the equation for this machine-learning model.

Machine learning model chart with equation

  • Furthermore, I will develop a formula using this equation to model the salaries. For this purpose, I have created a new column to store the Modeled Salaries.
  • Next, type the following formula in cell D5, and press ENTER. So, this will provide the salary for an employee with 0 years of experience.

=B5*869.3939394+1025.454545

Use of Regression formula to find the predicted output

  • Lastly, utilize the Fill Handle in order to apply the formula to the entire column.

Formula filled to all cells

Read More: How to Create Betting Algorithm in Excel


Step 4: Evaluate the Model’s Performance

In this step, I will find the difference between the actual values and the predicted values. Then, these values can be used to evaluate the accuracy of the model. Moreover, if more values are known, then the model can be updated.

  • Firstly, type the following formula in cell E5 to compare with real data and press Enter.

=C5-D5

  • Secondly, use the Fill Handle to fill the rest of the cells.

Formula to find the error values

  • Additionally, I have found the predicted salaries for four more unknown values.
  • If the actual values are known, you can rerun the regression analysis using these values. Thus, the model will be better.

Four more predicted outputs are calculated


Download Practice Workbook

You can download the Excel file from the link below.


Conclusion

These are all the steps you can follow to perform machine learning in Excel. Overall, in terms of working with time, we need this for various purposes. Hopefully, you can now easily make the needed adjustments. I sincerely hope you learned something and enjoyed this guide. Please let us know in the comments section below if you have any queries or recommendations.


Related Articles


<< Go Back to Algorithm in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Mehedi Hasan
Mehedi Hasan

Mehedi Hasan, a BSc graduate in Naval Architecture & Engineering from Bangladesh University of Engineering and Technology, plays a pivotal role as an Excel & VBA Content Developer at ExcelDemy. Fueled by a profound passion for research and innovation, he actively engages with Excel. In his capacity, Mehedi not only adeptly tackles intricate challenges but also showcases enthusiasm and expertise in navigating tough situations with finesse, underscoring his unwavering dedication to consistently delivering exceptional and high-quality content. He... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo