Nice one, m. This is exactly the kind of advanced function I had in mind when I created this. As an aside, you are using an outdated version of fnLDAPQuery(). After reviewing your script, it should work with the "official" version in the UDF forum.