View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default character value function?

I'm trying to find a way to add up the numerical value of a letters.

If I enter 'a' into cell A1, I would like cell B2 to show the number '1'

That way I can add up the numerical value of words.


If you type only letters and/or spaces into A1 (and no other characters
including punctuation marks), and assuming you don't want to count the
spaces in your total, then this formula will add up the values of the
letters in A1...

=SUMPRODUCT((CODE(MID(LOWER(A1),ROW(INDIRECT("A1:A "&LEN(A1))),1))-96)*(MID(LOWER(A1),ROW(INDIRECT("A1:A"&LEN(A1))),1 )<"
"))

where upper and lower case letters are considered as being the same. So, if
you type in "Hello There" (without the quote marks, just the letters and the
space), the above formula will return 108. If you need other characters
besides letters and spaces, let us know and we might be able to modify the
formula to account for them (make sure you tell us how you want them handled
though).

Rick