Connecting Tech Pros Worldwide Forums | Help | Site Map

efficient summing of letter-parts of a word...

Newbie
 
Join Date: Nov 2009
Posts: 2
#1: 3 Weeks Ago
i have a list of names
each name is spelt differently
each letter needs a numeric value assigned to it
e.g. a = 1, b = 2, c = 3, and so on....
i need to sum these letter values for each name-instance.

i would like to do this in MSAccess as well as MSExcel

what is the most efficient way of doing this ?

tafco

Delerna's Avatar
Expert
 
Join Date: Jan 2008
Location: Sydney
Posts: 788
#2: 3 Weeks Ago

re: efficient summing of letter-parts of a word...


THE most efficient way ????
Where
in an SQL Query?
in VBA code?
In other?

What criteria is involved? Different scenarios would have different efficiencies from any particular method....I feel


One way would be to determine the ascii code of each leter and subtract the ascii value of b.
That will get you a number for each letter.
Thats a simple statement, its more involved than that but you get the idea
eg. lowercase verses uppercase
Newbie
 
Join Date: Nov 2009
Posts: 2
#3: 3 Weeks Ago

re: efficient summing of letter-parts of a word...


this should be done in VBA code ...

:)
missinglinq's Avatar
Moderator
 
Join Date: Nov 2006
Location: Richmond, Virginia USA
Posts: 2,999
#4: 3 Weeks Ago

re: efficient summing of letter-parts of a word...


And how do you want to handle lowercase vs uppercase? Do you want a and A to have the same value?

These will give you the same value for both

Asc(UpperCaseLetter)-64

Asc(LowerCaseletter)-96

If you want the same value, for both uppercase and lowercase, convert the string to one, say lowercase, then parse them with

Asc(LowerCaseletter)-96

Welcome to Bytes!

Linq ;0)>
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,722
#5: 3 Weeks Ago

re: efficient summing of letter-parts of a word...


The most efficient way is to write a VBA function that returns the sum of the values. There is no shortcut. No inbuilt function or process whereby this may be done for you.

I suggest that you start work on this and let us know if you have any problems with it.

I include an excerpt of some instructions I sometimes need to give to clarify the position.

Before posting any question you are expected to attempt to find and work on a solution. When you find a specific problem with your attempt, that is the time to post here requesting assistance with any difficulties you have or about a particular function of the code that you don't know how to achieve. When posting your problem, details of the problem itself and where it's found are the bare minimum information required. The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you.

Code may be posted for reference purposes, but please don't expect us to work out the meaning of your problem by reverse-engineering your code. The question you post must make sense in its own right.
Reply