Hello,
I have a function that averages the grades in a column. Part of the function needs to use the code function. It returns #VALUE! whenever I have an empty cell in the range.
For example
If A4 is blank, then it will return an error.CODE(A1:A5)
How do I make it so that it doesn't count the blanks?
Hey ninjadan,
The code function is designed to work on a single cell, not a range. If you want it to go over an entire range, you would need to use an array formula or create a column designated for just that purpose.
I don't know why you would want to do that though, can you post an example, or a full formula?
Warm regards,
Shampoo Monkey
If you are happy with the results, please add to my reputation by clicking the icon next to the Post # in the bar above this post.
Try:
=CHAR(INT(SUM(IF(A1:A5<>"",CODE(A1:A5)))/COUNTA(A1:A5)))
confirmed with CTRL+SHIFT+ENTER
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
OR
=CHAR(AVERAGE(IF(ISNUMBER(CODE(A1:A5)),CODE(A1:A5),"")))
Also an array function so use CNTRL SHFT ENTER
Note: Your formula (and these formula's) seem flawed as if there is even 1 A and 4 B's, the result is A. Is that an issue?
ChemistB
My 2¢
Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)
I was thinking the same thing, Chemist. I would suggest using ROUND rather than INT. INT will always round down (disregard the decimal, actually) giving a higher average than may be true.
BBBAA would result in 97.6, and should average to a B.
BBAAA would result in 97.4 and should average to an A.
=CHAR(ROUND(SUM(IF(A1:A5<>"",CODE(A1:A5)))/COUNTA(A1:A5),0))
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks