How do I convert categorical data to numeric data in Excel? 2

How do I convert categorical data to numeric data in Excel?

Converting categorical data to numeric data in Excel refers to the process of transforming non-numerical data into numerical values that can be used in calculations and analysis. This can be achieved by assigning numerical codes or categories to the different levels of the categorical data. This allows for easier manipulation and interpretation of the data, as well as the ability to perform statistical analyses. The steps for converting categorical data to numeric data in Excel may vary depending on the specific data and desired outcome, but typically involve using functions such as IF, VLOOKUP, or INDEX/MATCH. This process can be useful in a variety of fields, such as business, finance, and research, for organizing and analyzing data in a more efficient and meaningful way.

Convert Categorical Data to Numeric in Excel


Often you may want to convert categorical data to numeric data in Excel to perform some specific type of analysis.

For example, suppose we ask 20 individuals to provide a categorical rating for some movie but we would actually like the categories to be converted to numerical values:

The following step-by-step example shows how to do so.

Step 1: Enter the Data

First, enter the data values into Excel:

Step 2: Use the IFS Function to Convert Categorical Values to Numeric Values

Next, we need to use the =IFS() function to convert the four categorical values of Great, Good, OK, Bad into numerical values of 4, 3, 2, 1.

In our example, we’ll type the following formula in cell C2:

=IFS(B2="Great", 4, B2="Good", 3, B2="OK", 2, B2="Bad", 1)

The following screenshot shows how to use this function in practice:

We can see that the first categorical value of Great has been converted to the numerical value of 4.

Step 3: Drag the Formula Down to All Cells

Lastly, we’ll simply drag the formula in cell C2 down to every remaining cell in column C:

  • All Great ratings have been converted to a numerical value of 4.
  • All Good ratings have been converted to a numerical value of 3.
  • All OK ratings have been converted to a numerical value of 2.
  • All Bad ratings have been converted to a numerical value of 1.

We can now proceed to perform some numerical analysis on the data.

For example, we might decide to calculate the mean value in the Numeric_Rating column to get an idea of how the average individual rated the movie.

Additional Resources

The following tutorials explain how to perform other common tasks in Excel:

Cite this article

stats writer (2024). How do I convert categorical data to numeric data in Excel?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-do-i-convert-categorical-data-to-numeric-data-in-excel/

stats writer. "How do I convert categorical data to numeric data in Excel?." PSYCHOLOGICAL SCALES, 28 Jun. 2024, https://scales.arabpsychology.com/stats/how-do-i-convert-categorical-data-to-numeric-data-in-excel/.

stats writer. "How do I convert categorical data to numeric data in Excel?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-do-i-convert-categorical-data-to-numeric-data-in-excel/.

stats writer (2024) 'How do I convert categorical data to numeric data in Excel?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-do-i-convert-categorical-data-to-numeric-data-in-excel/.

[1] stats writer, "How do I convert categorical data to numeric data in Excel?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How do I convert categorical data to numeric data in Excel?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top