I have a table where one of the columns is activities. That field can contain any letters of the alphabet. There can be no duplicates within a cell but there can be none or any. There is a blank between each letter for readability. For example:A C D F GA B[blank]M N O R Z

What is the best way to scan the table and count how many of each letter appears? I assume creating an array and indexing by the letter may work best for the variables. I also need the best way to scan the table and the individual cell that would be compatible with multiple browsers.ResultA - 2B - 1C - 1etc

Also I'm not sure I understand the purpose: does the site visitor type letters in a form field? (If OTOH you create the content yourself I don't see the point of a validation script. )

QUOTE

can contain any letters of the alphabet.

Do you mean a particular alphabet's charset? If any language's alphabet is allowed things may get hairy, if nothing else since you need a way for the script to separate various alphabets' characters from special characters).

QUOTE

I also need the best way to scan the table and the individual cell that would be compatible with multiple browsers.

This a table that I create but I constantly change. I wanted an automated way to count the letters.This is for a group going on a cruise.A - means they will attend event XXXB - means they will attend event YYYC - means they will attend event ZZZ

I want an automated way to count the number of people attending each event. Right now I manually count them and since changes are made often I sometimes make a mistake.

It's relatively easy to find an occurence of say letter A in a cell, and then add up all such occurences. Duplicates can then be excluded from the count (that is, multiple A letters in a cell still just count as one).

Do you also want to remove duplicates in each cell for "esthetic" reasons? That's more tricky (=bug prone), especially if there are linebreaks etc in the code.

I want an automated way to count the number of people attending each event. Right now I manually count them and since changes are made often I sometimes make a mistake.

It's relatively easy to find an occurence of say letter A in a cell, and then add up all such occurences. Duplicates can then be excluded from the count (that is, multiple A letters in a cell still just count as one).

Do you also want to remove duplicates in each cell for "esthetic" reasons? That's more tricky (=bug prone), especially if there are linebreaks etc in the code.

There will never be duplicates since I an entering the letters. There are no forced line breaks. There is a space between each letter.

I need to do 2 things. I need a way to do a loop through the cells that will work for any browser. The contents of a cell will then be assigned to a variable. This is where I had a problem of it working for Firefox and not IE. I have found routines that will accumulate numbers in the cells and I tried to alter one of them. The problem occurred when trying to place the contents of the cell into a variable. It worked in Firefox but was null in IE. Sorry I did not keep the code.

Now I need the best way to accumulate the count of each letter. I do not want to create 26 if statements. There must be a more esoteric way to do a scan of the variable and for each letter add one to its corresponding accumulator. I believe that arrays can be indexed by a name (letter) rather than occurrence number. My first try was with 26 if statements and 26 variables. This is too much code. There must be an easier way.

Note that I do this for fun and as a learning experience, not because it must be done. Obviously I can continue to do the count manually. I only want to program it if it can be done with a relatively short routine.

Once I have the accumulation I have no problem putting it on the page. I do it with date counts now.