Averaging a column of numbers after removing certain cells

Andy0311

Board Regular
Joined
Oct 16, 2019
Messages
118
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I need help automating several steps I now do in one column to complete my task. The task is to take letter grades run from an Excel column, convert them to numeric values in a new column to the right, and get a numeric average of the values. The column with a letter grade has a special leading character so that has to be removed so only the letter grade is in the cell. Also, not all cells convert to a number because there are blank spaces in the column. What I would like is to run a macro that converts the letter grade to a number (A=4, B=3, C=2, D=1, F=0), removes any cells that are not numbers, and calculates an average of the numbers in the column. Thank you.

Letter Grade
Numeric Value​
B
3​
B
3​
D
1​
A
4​
C
2​
B
3​
#VALUE!​
#VALUE!​
#VALUE!​
A
4​
D
1​
F
0​
A
4​
B
3​
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hello,
I don't think VBA is needed for this, see the simple formulas I have added here.
I see where you mention a special character needing to be stripped out, that too can be accomplished with a formula. See below for my example. If you provide examples of the special character, that too can be incorporated into the formula.

Book1
ABCD
1Letter GradeNumeric ValueLetter Conversion2.27
2B33
3B33
4D14
5A44
6C22
7B33
8#VALUE! 
9#VALUE! 
10#VALUE! 
11A44
12D14
13F0 
14A44
15B33
Sheet1
Cell Formulas
RangeFormula
D1D1=SUM(C:C)/COUNTA(C:C)
C2:C15C2=IFERROR(IFS(A2="A",4,A2="B",3,A2="C",2,A2="D",4),"")
 
Upvote 0
Solution
Hello,
I don't think VBA is needed for this, see the simple formulas I have added here.
I see where you mention a special character needing to be stripped out, that too can be accomplished with a formula. See below for my example. If you provide examples of the special character, that too can be incorporated into the formula.

Book1
ABCD
1Letter GradeNumeric ValueLetter Conversion2.27
2B33
3B33
4D14
5A44
6C22
7B33
8#VALUE! 
9#VALUE! 
10#VALUE! 
11A44
12D14
13F0 
14A44
15B33
Sheet1
Cell Formulas
RangeFormula
D1D1=SUM(C:C)/COUNTA(C:C)
C2:C15C2=IFERROR(IFS(A2="A",4,A2="B",3,A2="C",2,A2="D",4),"")
Thanks for helping me. This really helped.
 
Upvote 0
Thanks for helping me. This really helped.
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
 
Upvote 0
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
Can one both thank the person who helped provide the solution and mark the post as solved?
 
Upvote 0
Can one both thank the person who helped provide the solution and mark the post as solved?
The "solution mark" is not only an indicator that shows the question has an answer, but also the pointer to the solution post. Therefore, if a question has an answer then we mark that post as the solution.
Hope this makes sense.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

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