Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Formula to count the number of different letters in a word

$
0
0

In sheets, suppose cell A1 contains the word CABBAGE.

I want to put a formula into, say, cell B1 that will count the number of different letters. So the output should be 5, because there are 5 different letters in CABBAGE.

I have a formula that will do this, however it is cumbersome and I bet there is a way to do it more concisely.

The formula that works is:

=if(isnumber(search("A",A1)),1,0) + if(isnumber(search("B",A1)),1,0) + ... + if(isnumber(search("Z",A1)),1,0)

The formula adds 1 each time a letter is present in the word. I'm just not sure of the best way to consolidate the 26 terms into something more manageable.


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>