lrobbo314
Well-known Member
- Joined
- Jul 14, 2008
- Messages
- 3,963
- Office Version
- 365
- Platform
- 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.
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 | ||||
---|---|---|---|---|
A | B | |||
1 | Original | Mapped Value | ||
2 | 1 | 1.00 | ||
3 | 2 | 3.57 | ||
4 | 3 | 6.13 | ||
5 | 4 | 8.70 | ||
6 | 5 | 11.26 | ||
7 | 6 | 13.83 | ||
8 | 7 | 16.39 | ||
9 | 8 | 18.96 | ||
10 | 9 | 21.53 | ||
11 | 10 | 24.09 | ||
12 | 11 | 26.66 | ||
13 | 12 | 29.22 | ||
14 | 13 | 31.79 | ||
15 | 14 | 34.35 | ||
16 | 15 | 36.92 | ||
17 | 16 | 39.48 | ||
18 | 17 | 42.05 | ||
19 | 18 | 44.62 | ||
20 | 19 | 47.18 | ||
21 | 20 | 49.75 | ||
22 | 21 | 52.31 | ||
23 | 22 | 54.88 | ||
24 | 23 | 57.44 | ||
25 | 24 | 60.01 | ||
26 | 25 | 62.58 | ||
27 | 26 | 65.14 | ||
28 | 27 | 67.71 | ||
29 | 28 | 70.27 | ||
30 | 29 | 72.84 | ||
31 | 30 | 75.40 | ||
32 | 31 | 77.97 | ||
33 | 32 | 80.54 | ||
34 | 33 | 83.10 | ||
35 | 34 | 85.67 | ||
36 | 35 | 88.23 | ||
37 | 36 | 90.80 | ||
38 | 37 | 93.36 | ||
39 | 38 | 95.93 | ||
40 | 39 | 98.49 | ||
41 | 40 | 101.06 | ||
42 | 41 | 103.63 | ||
43 | 42 | 106.19 | ||
44 | 43 | 108.76 | ||
45 | 44 | 111.32 | ||
46 | 45 | 113.89 | ||
47 | 46 | 116.45 | ||
48 | 47 | 119.02 | ||
49 | 48 | 121.59 | ||
50 | 49 | 124.15 | ||
51 | 50 | 126.72 | ||
52 | 51 | 129.28 | ||
53 | 52 | 131.85 | ||
54 | 53 | 134.41 | ||
55 | 54 | 136.98 | ||
56 | 55 | 139.55 | ||
57 | 56 | 142.11 | ||
58 | 57 | 144.68 | ||
59 | 58 | 147.24 | ||
60 | 59 | 149.81 | ||
61 | 60 | 152.37 | ||
62 | 61 | 154.94 | ||
63 | 62 | 157.51 | ||
64 | 63 | 160.07 | ||
65 | 64 | 162.64 | ||
66 | 65 | 165.20 | ||
67 | 66 | 167.77 | ||
68 | 67 | 170.33 | ||
69 | 68 | 172.90 | ||
70 | 69 | 175.46 | ||
71 | 70 | 178.03 | ||
72 | 71 | 180.60 | ||
73 | 72 | 183.16 | ||
74 | 73 | 185.73 | ||
75 | 74 | 188.29 | ||
76 | 75 | 190.86 | ||
77 | 76 | 193.42 | ||
78 | 77 | 195.99 | ||
79 | 78 | 198.56 | ||
80 | 79 | 201.12 | ||
81 | 80 | 203.69 | ||
82 | 81 | 206.25 | ||
83 | 82 | 208.82 | ||
84 | 83 | 211.38 | ||
85 | 84 | 213.95 | ||
86 | 85 | 216.52 | ||
87 | 86 | 219.08 | ||
88 | 87 | 221.65 | ||
89 | 88 | 224.21 | ||
90 | 89 | 226.78 | ||
91 | 90 | 229.34 | ||
92 | 91 | 231.91 | ||
93 | 92 | 234.47 | ||
94 | 93 | 237.04 | ||
95 | 94 | 239.61 | ||
96 | 95 | 242.17 | ||
97 | 96 | 244.74 | ||
98 | 97 | 247.30 | ||
99 | 98 | 249.87 | ||
100 | 99 | 252.43 | ||
101 | 100 | 255.00 | ||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
A2:A101 | A2 | =SEQUENCE(100) |
B2:B101 | B2 | =MAPRANGE(MIN(A2#),MAX(A2#),1,255,A2#) |
Dynamic array formulas. |
Upvote
0