I have an Excel function which I'm trying to translate to C# equivalent code. The function (in Excel) is as follows:
WorksheetFunction.VLookup(number, Range("numberDictionary"), 2, True)
Essentially what this function does is...
Assuming a dictionary exists, defined as follows:
Number | Value
1 | 2
3 | 8
9 | 1
And assuming that my parameter 'number' equals 2
I would expect a Value returned of 8, as the lookup function would round my input number 2 up to the nearest number in the range (3) and then return the associated value.
Can anyone tell me how I might achieve the same thing in C# code? Assuming the use of a Dictionary<int, int>()
Many thanks in advance
Ian