Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Coverting 1 letter codes into a sum value?


Is it possible for me to have excel sum all the one letter codes into
individual cells and let me know the count?

Ie. (AAABBCDDDD) A=3, B=2, C=1, D=4
and have those sums placed in an individual cell for each?

Thanks for the help.


--
Pookie76
------------------------------------------------------------------------
Pookie76's Profile: http://www.excelforum.com/member.php...o&userid=12815
View this thread: http://www.excelforum.com/showthread...hreadid=527647

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Coverting 1 letter codes into a sum value?

Try some code like the following:

Dim S As String
Dim Total As Double
Dim Ndx As Long
S = "AAABBCCDD"
For Ndx = 1 To Len(S)
Select Case UCase(Mid(S, Ndx, 1))
Case "A"
Total = Total + 1
Case "B"
Total = Total + 2
Case "C"
Total = Total + 3
Case "D"
Total = Total + 4
Case Else
End Select
Next Ndx
Debug.Print Total



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Pookie76"
wrote in
message
...

Is it possible for me to have excel sum all the one letter
codes into
individual cells and let me know the count?

Ie. (AAABBCDDDD) A=3, B=2, C=1, D=4
and have those sums placed in an individual cell for each?

Thanks for the help.


--
Pookie76
------------------------------------------------------------------------
Pookie76's Profile:
http://www.excelforum.com/member.php...o&userid=12815
View this thread:
http://www.excelforum.com/showthread...hreadid=527647



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default Coverting 1 letter codes into a sum value?

Hi Pookie,

With formulas, assuming your input cell is A1 :
=LEN(A1)-LEN(SUBSTITUTE(A1,"A",""))
=LEN(A1)-LEN(SUBSTITUTE(A1,"B",""))
=LEN(A1)-LEN(SUBSTITUTE(A1,"C",""))
=LEN(A1)-LEN(SUBSTITUTE(A1,"D",""))
HTH
Carim

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Coverting 1 letter codes into a sum value?


Thanks again for the help. The coding works perfectly.


--
Pookie76
------------------------------------------------------------------------
Pookie76's Profile: http://www.excelforum.com/member.php...o&userid=12815
View this thread: http://www.excelforum.com/showthread...hreadid=527647

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
Search a string in a cell for a list of 3 letter codes SteveT Excel Worksheet Functions 3 November 7th 08 03:11 AM
Looking up a value within a range of 3 letter or number codes Jimmy Excel Worksheet Functions 4 June 6th 08 07:11 PM
Looking up a value within a range of 3 letter or number codes... Jimmy Excel Worksheet Functions 6 June 4th 08 07:16 PM
Vlookup using letter and numeric codes LW_Greeney Excel Discussion (Misc queries) 2 May 23rd 06 05:24 PM
press letter and go 2 entry begin w letter in data validation drop MCP Excel Programming 1 August 28th 04 05:07 PM


All times are GMT +1. The time now is 05:57 PM.

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

About Us

"It's about Microsoft Excel"