9

Excel Formula to Scale Data from 0 to 1

 3 years ago
source link: https://travishorn.com/excel-formula-to-scale-data-from-0-to-1-64008ffc2013
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Excel Formula to Scale Data from 0 to 1

Say we have a set of data in column A.

469
396
600
177
240
155
204
454
278
233

And we want to scale the data so that the lowest value equates to 0 and the highest value equates to 1.

1*--yRKfQgUax697H1_yj2JA.png?q=20
excel-formula-to-scale-data-from-0-to-1-64008ffc2013

If you just want a quick formula to do this, you can copy the line below. However, you may consider reading further to really understand how it works.

=(A1 - MIN(A:A)) / (MAX(A:A) - MIN(A:A))

First, figure out the minimum value in the set.

=MIN(A:A)

In this case, it’s 155.

1*vR_TDz_UWQlxQboh46Zvbg.png?q=20
excel-formula-to-scale-data-from-0-to-1-64008ffc2013

Now for each value, figure out the difference from the minimum.

=A1 - MIN(A:A)

Looking at each value…

=A1  - MIN(A:A)          = 469 - 155          = 314 
=A2 - MIN(A:A) = 396 - 155 = 241
=A3 - MIN(A:A) = 600 - 155 = 445
=A4 - MIN(A:A) = 177 - 155 = 22
=A5 - MIN(A:A) = 240 - 155 = 85
=A6 - MIN(A:A) = 155 - 155 = 0
=A7 - MIN(A:A) = 204 - 155 = 49
=A8 - MIN(A:A) = 454 - 155 = 299
=A9 - MIN(A:A) = 278 - 155 = 123
=A10 - MIN(A:A) = 233 - 155 = 78
1*EBWWjoIHd-2WuEa1_gTOeA.png?q=20
excel-formula-to-scale-data-from-0-to-1-64008ffc2013

Next, figure out the largest difference. This is simply the different between MAX(A:A) and MIN(A:A).

=MAX(A:A) - MIN(A:A)          = 600 - 155          = 445
1*THo193lL_jEB5-elOc0iyw.png?q=20
excel-formula-to-scale-data-from-0-to-1-64008ffc2013

For each value, calculate what percentage it’s difference is when compared to this maximum difference.

=(A1  - MIN(A:A)) / (MAX(A:A) - MIN(A:A))        = (469 - 155) / 445
=(A2 - MIN(A:A)) / (MAX(A:A) - MIN(A:A)) = (396 - 155) / 445
=(A3 - MIN(A:A)) / (MAX(A:A) - MIN(A:A)) = (600 - 155) / 445
=(A4 - MIN(A:A)) / (MAX(A:A) - MIN(A:A)) = (177 - 155) / 445
=(A5 - MIN(A:A)) / (MAX(A:A) - MIN(A:A)) = (240 - 155) / 445
=(A6 - MIN(A:A)) / (MAX(A:A) - MIN(A:A)) = (155 - 155) / 445
=(A7 - MIN(A:A)) / (MAX(A:A) - MIN(A:A)) = (204 - 155) / 445
=(A8 - MIN(A:A)) / (MAX(A:A) - MIN(A:A)) = (454 - 155) / 445
=(A9 - MIN(A:A)) / (MAX(A:A) - MIN(A:A)) = (278 - 155) / 445
=(A10 - MIN(A:A)) / (MAX(A:A) - MIN(A:A)) = (233 - 155) / 445

The result is what we’re looking for.

=(A1  - MIN(A:A)) / (MAX(A:A) - MIN(A:A))          = 0.71
=(A2 - MIN(A:A)) / (MAX(A:A) - MIN(A:A)) = 0.54
=(A3 - MIN(A:A)) / (MAX(A:A) - MIN(A:A)) = 1.00
=(A4 - MIN(A:A)) / (MAX(A:A) - MIN(A:A)) = 0.05
=(A5 - MIN(A:A)) / (MAX(A:A) - MIN(A:A)) = 0.19
=(A6 - MIN(A:A)) / (MAX(A:A) - MIN(A:A)) = 0.00
=(A7 - MIN(A:A)) / (MAX(A:A) - MIN(A:A)) = 0.11
=(A8 - MIN(A:A)) / (MAX(A:A) - MIN(A:A)) = 0.67
=(A9 - MIN(A:A)) / (MAX(A:A) - MIN(A:A)) = 0.28
=(A10 - MIN(A:A)) / (MAX(A:A) - MIN(A:A)) = 0.18
1*yOmboKET2jRwW3TtpIkztQ.png?q=20
excel-formula-to-scale-data-from-0-to-1-64008ffc2013

As you can see, the lowest value 155 is scaled to 0.00 while the highest value 600 is scaled to 1.00. All the other values are proportionately somewhere in between.

This can be useful when used on multiple columns to normalize the data and make scores or comparisons.

Once again, the final formula is:

=(A1 - MIN(A:A)) / (MAX(A:A) - MIN(A:A))

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK