Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel Function name to map one ratio to another

I can't figure out the terminology to search for the function I want:

Anrduino has a map(value,inLo,inHi,outLo,outHi) function that takes a value within IN range and returns the value with the same ratio mapped to the OUT range. For example map(5,0,6,200,380) returns 350 because the value 5 in a range of 0-6 is 5/6 and 5/6 of the range from 200 to 380 is 350.

I can write my own function in Excel but I am guessing there is something built in.

like image 779
Playing with GAS Avatar asked Dec 21 '25 06:12

Playing with GAS


1 Answers

Very good explanation is given by James Ramsden here: http://james-ramsden.com/map-a-value-from-one-number-scale-to-another-formula-and-c-code/

Essentially if one scale is from a0 to a1 and other scale is from b0 to b1 and you want to map the value a to some value of b. The equation is:

enter image description here

Put in the same terms as the original question:

map(value, inLo, inHi, outLo, outHi) = outLo + (outHi - outLo) * (value - inLo) / (inHi - inLo)

like image 83
wilkas Avatar answered Dec 22 '25 22:12

wilkas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!