Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 26
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.

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default character value function?

=CODE(LOWER(A1))-96


"Raza" wrote:

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.

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,202
Default character value function?

Actually, this modified formula will sum ONLY the letter values, no matter
what other characters you mix into the text.

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

So, the text "a.b,c?d=e" will sum to 15 which is the sum of a=1, b=2, c=3,
d=4, e=5, etc.

Now, I'll let the people here who really know how to construct formulas
figure out how to trim this one down to a more reasonable size.

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
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


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default character value function?

I don't have any fantastic suggestions, but you could eliminate one function
call by replacing NOT(ISERROR(FIND(..))) with ISNUMBER(FIND(..))


"Rick Rothstein (MVP - VB)" wrote:

Actually, this modified formula will sum ONLY the letter values, no matter
what other characters you mix into the text.

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

So, the text "a.b,c?d=e" will sum to 15 which is the sum of a=1, b=2, c=3,
d=4, e=5, etc.

Now, I'll let the people here who really know how to construct formulas
figure out how to trim this one down to a more reasonable size.

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
wild character in function? Greg Excel Discussion (Misc queries) 3 July 29th 07 01:38 PM
Can I use character masks within a function? jbouwhuis Excel Worksheet Functions 1 February 9th 06 10:59 PM
character limit in hyperlink function Brad B. Excel Worksheet Functions 0 December 22nd 05 11:04 PM
... Count Function ... with any character ... Dr. Darrell Excel Discussion (Misc queries) 4 August 9th 05 10:00 PM
How do I use the wildcard character and the NOT function? KDA Excel Worksheet Functions 1 June 24th 05 04:36 PM


All times are GMT +1. The time now is 11:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"