none
Transpose function RRS feed

  • Question

  • I'm sure i have done this before but cannot remember the function I used

    i want to transpose a number from one range to another. for example if I have one range 0-100 and another range 100-0 (same range but max and min are reversed) if i put 20 in i would get 80 out

    I have used the search term transpose from one range to another. but I'm not coming up with much luck.

    Apologies ahead of time if this is in the wrong forum.

    And thanks in advance for your help!


    Yep... Need more coffee

    Saturday, July 19, 2014 12:13 PM

Answers

  • Forget that this is a math problem... 

        Private Function Range(x As Integer, in_min As Integer, in_max As Integer, out_min As Integer, out_max As Integer)
            Return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
        End Function


    Yep... Need more coffee

    • Marked as answer by David H BEng Sunday, July 20, 2014 9:50 AM
    Sunday, July 20, 2014 9:50 AM