Wildcard Characters


* (Asterisk)

This represents multiple characters.
For example Ex* will identify Excel, Example, Expert etc.


? (Question Mark)

This represents a single character.
For example We?k will identify Week and Weak.


Identifying Wildcard Characters (VBA)

In VBA this can be done by placing these characters inside square brackets [ ].

Debug.Print "a*c" Like "a[*]c"    '= True  
Debug.Print "a?c" Like "a[?]c" '= True
Debug.Print "abc" Like "a[*]c" '= False
Debug.Print "abc" Like "a[?]c" '= False
Debug.Print "abc" Like "a*c" '= True
Debug.Print "abc" Like "a?c" '= True

Identifying Wilcard Characters (Excel)

In Excel this can be done using the tilde (~) character as a prefix.

=XLOOKUP("A~*", B3:B14, C3:C14, "Not found", 2) 
=XLOOKUP("A~?C", B3:B14, C3:C14, "Not found", 2)
=XLOOKUP("A~~C", B3:B14, C3:C14, "Not found", 2)

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext