Returns the closest matching numerical key in the dictionary. The key is returned as a string so that it can be used in a nested call that reads a cell value.
string FindClosestDicKey(string dictionaryName; double value; [int closestHigherOrLower])
dictionaryName |
The name of the dictionary to find the closest key in. |
value |
The value to find the closest matching key for. |
closestHigherOrLower |
Optional filter. Find closest key = 0, Find closest higher or equal key = 1, Find closest lower or equal key = -1 |
Examples
FindClosestDicKey("PrimeNumbers"; 6000)
Returns the key closest to 6000 in the dictionary "PrimeNumbers", e.g. "6007".
FindClosestDicKey("PrimeNumbers"; 6000; -1)
Returns the key closest lower or equal to 6000 in the dictionary "PrimeNumbers", e.g. "5987".
Remarks
This method requires that the keys of the dictionary are numerical or can be converted to double using "NumberFormatInfo.InvariantInfo".