Also - while probably not an issue, you might be better served with "&" instead of "And" to force a binary comparison. you can simplify this. "$Val & 4" would zero all other bits, allowing a Boolean comparison - "If $Val & 4" instead of the mathematical comparison.

I use this construct extensively in several of my UDFs.

Glenn


Edited by Glenn Barnas (2018-02-03 08:56 PM)
_________________________
Actually I am a Rocket Scientist! \:D