This is more PHP as you need to use str_word_count()
to count the amount of words in the excerpt. Just note, to be safe, if you allow any tags in the excerpt, you would want to use strip_tags()
to remove html tags to avoid incorrect word counts.
EXAMPLE:
echo str_word_count( strip_tags( get_the_excerpt() ) );
If you need to display wordcount on the front end, you can also wrap the above in number_format_i18n()
to return the integer value according to locale set
echo number_format_i18n( str_word_count( strip_tags( get_the_excerpt() ) ) );