excel - Finding multiple counts of phrase in a single cell -
excel - Finding multiple counts of phrase in a single cell -
i need counts number of times phrase presents in single cell.
cell b5 contains value "test 123 test 1234"
sub count() ival = application.worksheetfunction.countif(range("b5"), "test") msgbox ival end function this returns "0" because it's not exact match. want counts number of times "test" in cell , returns 2 value.
combine split , ubound
split string 0 based 1d array of substrings, find upperbound of array using ubound
sub count() dim count integer count = ubound(split(range("b5"), "123")) msgbox count end sub excel excel-vba
Comments
Post a Comment