MAPRANGE

=MAPRANGE(INT,INT,INT,INT)

input_start
The minimum value of the original range
input_end
The maximum value of the original range
output_start
The minimum value of the new range
output_end
The maximum value of the new range
input
Value to be converted

MAPRANGE takes the min and max values of a given range of numbers and converts an input value to a new range of numbers.

lrobbo314

Well-known Member
Joined
Jul 14, 2008
Messages
3,957
Office Version
  1. 365
Platform
  1. Windows
MAPRANGE takes the min and max values of a given range of numbers and converts an input value to a new range of numbers.

An example I've used in graphical applications is needing to map a value that could go from 1 to 100 and convert a number in that range to a number between 1 and 255 to be used as an RGB value.

Excel Formula:
=LAMBDA(
    input_start,
    input_end,
    output_start,
    output_end,
    input,
        output_start + ((output_end - output_start) / (input_end - input_start)) * (input - input_start)
)

COMPSTAT Template1
AB
1OriginalMapped Value
211.00
323.57
436.13
548.70
6511.26
7613.83
8716.39
9818.96
10921.53
111024.09
121126.66
131229.22
141331.79
151434.35
161536.92
171639.48
181742.05
191844.62
201947.18
212049.75
222152.31
232254.88
242357.44
252460.01
262562.58
272665.14
282767.71
292870.27
302972.84
313075.40
323177.97
333280.54
343383.10
353485.67
363588.23
373690.80
383793.36
393895.93
403998.49
4140101.06
4241103.63
4342106.19
4443108.76
4544111.32
4645113.89
4746116.45
4847119.02
4948121.59
5049124.15
5150126.72
5251129.28
5352131.85
5453134.41
5554136.98
5655139.55
5756142.11
5857144.68
5958147.24
6059149.81
6160152.37
6261154.94
6362157.51
6463160.07
6564162.64
6665165.20
6766167.77
6867170.33
6968172.90
7069175.46
7170178.03
7271180.60
7372183.16
7473185.73
7574188.29
7675190.86
7776193.42
7877195.99
7978198.56
8079201.12
8180203.69
8281206.25
8382208.82
8483211.38
8584213.95
8685216.52
8786219.08
8887221.65
8988224.21
9089226.78
9190229.34
9291231.91
9392234.47
9493237.04
9594239.61
9695242.17
9796244.74
9897247.30
9998249.87
10099252.43
101100255.00
Sheet1
Cell Formulas
RangeFormula
A2:A101A2=SEQUENCE(100)
B2:B101B2=MAPRANGE(MIN(A2#),MAX(A2#),1,255,A2#)
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,526
Messages
6,172,833
Members
452,483
Latest member
Johnstone

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top