Count A characters in a cell As a given number

crilly

New Member
Joined
Nov 26, 2009
Messages
21
A
7
Count A characters in a cell As a given number Like ( A - As - 7 )
B
6
To return the like of 14 for A-A or 13 for A-B
C
5
so A- B- C in 3 cell add up to 18 and so on
D
4
E
3
F
2
G
1

<tbody>
</tbody>
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Why is A-B equal to 13 and A-B-C equal to 18? What haven't you told us about those other letters besides A?
 
Upvote 0
=LEN(C1)-LEN(SUBSTITUTE(UPPER(C1),UPPER(B1),"")) will give you the letter count. Not sure what else you are asking for.
 
Last edited:
Upvote 0
Can you give a sample of your data as well
 
Upvote 0
See if this user-defined function is any use. To implement ..
1. Right click the sheet name tab and choose "View Code".
2. In the Visual Basic window use the menu to Insert|Module
3. Copy and Paste the code below into the main right hand pane that opens at step 2.
4. Close the Visual Basic window.
5. Enter the formula as shown in the screen shot below and copy down.
6. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm)

Code:
Function mySum(s As String, rSubs As Range) As Long
  Dim Subs As Variant
  Dim i As Long
  
  Subs = rSubs.Value
  s = "-" & Replace(s, "-", "--") & "-"
  For i = 1 To UBound(Subs)
    s = Replace(s, "-" & Subs(i, 1) & "-", "-" & Subs(i, 2) & "-")
  Next i
  mySum = Evaluate(Replace(s, "-", "+0"))
End Function


Excel 2016
ABCDE
1A7A7
2B6A-A14
3C5A-B-C18
4D4A-B13
5E3
6F2
7G1
8
Sub Values
Cell Formulas
RangeFormula
E1=mySum(D1,A$1:B$7)
 
Last edited:
Upvote 0
Hi, another option you can try that makes use of a technique that Rick posted here:

http://www.excelfox.com/forum/showthread.php/333-Get-Field-from-Delimited-Text-String

Note. This is hard coded for a maximum of 10 items in the criteria cell. This can be made more dynamic if needed.


Excel 2013/2016
ABCDE
1A7A7
2B6A-A14
3C5A-B13
4D4A-B-C18
5E3
6F2
7G1
Sheet1
Cell Formulas
RangeFormula
E1=SUMPRODUCT(SUMIFS(B:B,A:A,TRIM(MID(SUBSTITUTE(D1,"-",REPT(" ",99)),{1,2,3,4,5,6,7,8,9,10}*99-98,99))))
 
Last edited:
Upvote 0

So at the end of the week and month I can get a total ofpoints for the person,

To get a (grade and point value )

A Has a Value of 7 - B Has a Value of 6 - C Has a Value of 5 - D Has a Value of 4



E Has a Value of 3 - F Has a Value of 2 - G Has a Value of 1



Mon 22/07/2019
A
A
A
A
A
D
A
46
Fri 26/07/2019
B
B
A
B
A
F
A
41
Sat 27/07/2019
B
A
A
B
A
F
A
42
Sun 28/07/2019
B
C
A
A
A
E
A
42
<tbody> </tbody>





 
Upvote 0
Hi, here is one option..:


Excel 2013/2016
ABCDEFGHI
1Mon 22/07/2019AAAAADA46
2Fri 26/07/2019BBABAFA41
3Sat 27/07/2019BAABAFA42
4Sun 28/07/2019BCAAAEA42
Sheet1
Cell Formulas
RangeFormula
I1=SUMPRODUCT(COUNTIF(B1:H1,{"A","B","C","D","E","F","G"}),{7,6,5,4,3,2,1})
 
Upvote 0
Hi, here is one option..:


Excel 2013/2016
ABCDEFGHI
1Mon 22/07/2019AAAAADA46
2Fri 26/07/2019BBABAFA41
3Sat 27/07/2019BAABAFA42
4Sun 28/07/2019BCAAAEA42
Sheet1
Cell Formulas
RangeFormula
I1=SUMPRODUCT(COUNTIF(B1:H1,{"A","B","C","D","E","F","G"}),{7,6,5,4,3,2,1})

Using the same setup you show, here is another formula for the OP to consider...

=SUMPRODUCT(72-CODE(B1:H1))
 
Upvote 0

Forum statistics

Threads
1,214,810
Messages
6,121,690
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top