narnian_uk
New Member
- Joined
- Jul 28, 2021
- Messages
- 21
- Office Version
- 365
- Platform
- Windows
- MacOS
I'm using the Damerau-Levenshtein function set out on GitHub - physics515/VBA-Common-Library: A library of common VBA functions., which creates a public function called "damerau":
The function works fine; for example
will give a result of 1 because one character swap is required. Similarly,
where N3# is a list of names and A2 contains a single name will produce the expected spilled array of DL values ({0; 13; 12; 13; etc.}). However,
produces an #N/A, and I can't work out why; I would have expected it to yield a value of 0. Any thoughts...?
This function takes two strings of any length and calculates the Damerau-Levenshtein Distance between them. Damerau-Levenshtein Distance differs from Levenshtein Distance in that it includes an additional operation, called Transpositions, which occurs when two adjacent characters are swapped. Thus, Damerau-Levenshtein Distance calculates the number of Insertions, Deletions, Substitutions, and Transpositons needed to convert string1 into string2. As a result, this function is good when it is likely that spelling errors have occured between two string where the error is simply a transposition of 2 adjacent characters.
The function works fine; for example
Excel Formula:
=damerau("Test", "Tset")
will give a result of 1 because one character swap is required. Similarly,
Excel Formula:
=BYROW(N3#, LAMBDA(name, damerau(A2, name)))
where N3# is a list of names and A2 contains a single name will produce the expected spilled array of DL values ({0; 13; 12; 13; etc.}). However,
Excel Formula:
=MIN(BYROW(N3#, LAMBDA(name, damerau(A2, name))))
produces an #N/A, and I can't work out why; I would have expected it to yield a value of 0. Any thoughts...?