Function String Words Class

Soundex

Convert a string to its four-character Soundex code, which will be the same for many words which are spelled similarly. Useful for finding the names within a database table that are spelled similarly.

Signature (Visual Basic / VBA)

Public Function Soundex( _
    ByVal vValue As Variant _
    ) As Variant

Code Example

    Soundex("Smith") = "S530"
    Soundex("Smythe") = "S530"
    Soundex("Jones") = "J520"

Parameters

Parameter Description
vValue String containing the English word or phrase which is to be converted to a four-character Soundex code. Function returns Null if vValue is Null or cannot be fixed up to a String.

Notes & Version History

Note The MetaPhone function is better at distinguishing words which are spelled differently but may have a similar meaning.
Algorithm The first character of each string is copied to the result string. The rest of the characters are grouped into one of six classes each represented by a numeric digit from 1 to 6. Sequences of more than one character from the same character class are represented by only one class identifier. Vowels are ignored, except that they separate repeated runs of characters which would otherwise be condensed to a single number for the character class. The result string is to be no longer than four characters long, but if it is less than four characters long, it is right-filled with zero characters.