Calculating %'s with IF and Sum/SumIF

B

Billy B

I have the following formula that works correctly. The formulas is used to
calculate grades for my classroom.

=IF(COUNT(G8:p8,U8,V8)<12,"",VLOOKUP(SUM(G8:p8,U8:V8/(SUMIF(G8:p8,">0",$G$7:$P$7)+SUMIF(U8:V8,">0",$U$7:$V$7)),GradeTbl,2))

What I am trying to do is weigh the grades so the range G8:p8 constitute 40%
of the grade and the range U8:V8 constitue 60% of the grade, then using
Vlookup show the grade.

I have tried Sum((G8:p8)*.4),(U8:V8)*.6)) in the SUM(G8:p8,U8:V8 part of the
formula but get an error message. I have tried others with no success.

Is it possible to accomplish what I am trying to do with one formula?

Thank you.
 
B

Bob Phillips

That formula does not work correctly, it errors out on input, 'too few
arguments'. What is the real formula?
 
B

Bob Phillips

It seems to be a missing ), this was allowed

=IF(COUNT(G8:p8,U8,V8)<12,"",VLOOKUP(SUM(G8:p8,U8:V8/(SUMIF(G8:p8,">0",$G$7:$P$7)+SUMIF(U8:V8,">0",$U$7:$V$7))),GradeTbl,2))

but can you show some data t try it on
 
B

Billy B

Bob Phillips said:
It seems to be a missing ), this was allowed

=IF(COUNT(G8:p8,U8,V8)<12,"",VLOOKUP(SUM(G8:p8,U8:V8/(SUMIF(G8:p8,">0",$G$7:$P$7)+SUMIF(U8:V8,">0",$U$7:$V$7))),GradeTbl,2))

but can you show some data t try it on

--

HTH

Bob
Rows G H I J K L M N O P Q
R S U V W
7
8 Possible 10 10 10 10 10 10 10 10 10 10 20
20
9 Earned 9 10 10 8 10 10 8 10 7 10
16 15 =IF....

and the formula in W9, copied and pasted
=IF(COUNT(G8:p8,U8,V8)<12,"",VLOOKUP(SUM(G8:p8,U8,V8)/(SUMIF(G8:p8,">0",$G$7:$P$7)+SUMIF(U8:V8,">0",$U$7:$V$7)),GradeTbl,2))

Hope this helps....thanks again
 
B

Bob Phillips

Your formula refers to data in row 7, but your example shows nothing, and
what about GradeTbl?
 
B

Bob Phillips

I'll take a punt anyway

=IF(COUNT(G8:p8,U8,V8)<12,"",VLOOKUP((SUM(G8:p8)/SUM($G$7:$P$7))*40%+(SUM(U8+V8)/SUM($U$7:$V$7))*60%,GradeTbl,2))
 
J

Joe User

Bob Phillips said:
I'll take a punt anyway

=IF(COUNT(G8:p8,U8,V8)<12,"",VLOOKUP((SUM(G8:p8)/SUM($G$7:$P$7))*40%+(SUM(U8+V8)/SUM($U$7:$V$7))*60%,GradeTbl,2))

--

HTH

Bob
 
J

Joe User

Bob Phillips said:
=IF(COUNT(G8:p8,U8,V8)<12,"",
VLOOKUP((SUM(G8:p8)/SUM($G$7:$P$7))*40%+
(SUM(U8+V8)/SUM($U$7:$V$7))*60%,GradeTbl,2))

Just commenting on syntax, without vetting the solution....

What useful purpose does SUM serve in the context SUM(U8+V8)?

Also, reordering of terms will avoid some needless parentheses without
sacrificing readability, IMHO. To wit:

=IF(COUNT(G8:p8,U8,V8)<12, "",
VLOOKUP(40%*SUM(G8:p8)/SUM($G$7:$P$7) +
60%*(U8+V8)/SUM($U$7:$V$7),GradeTbl,2))

Note: Perhaps Bob meant to write SUM(U8,V8). Although that can serve a
useful purpose sometimes, I think it is redundant here, given the
conditional test COUNT(G8:p8,U8,V8)<12.


-----
PS: Sorry about the earlier contentless response. Clicked on the wrong
button.


----- original message -----
 
B

Bob Phillips

It was just a typo, I meant to write SUM(U8:V8) as I did with
SUM($U$7:$V$7). I did this deliberately so that region could be extended (to
W, X, and so on) with minimal change.
 
J

Joe User

Bob Phillips said:
It was just a typo, I meant to write SUM(U8:V8) as I
did with SUM($U$7:$V$7). I did this deliberately so
that region could be extended (to W, X, and so on)
with minimal change.

I thought as much. But then, I would have written COUNT(G8:p8,U8:V8) or
SUM(U8,V8) to be consistently extensible.


----- original message -----
 
B

Bob Phillips

Yeah, looking at it now, but when I built my answer that was the part I
wasn't looking at :-(
 
J

Joe User

Bob Phillips said:
Yeah, looking at it now, but when I built my answer
that was the part I wasn't looking at :-(

Been there, done that. ;-)


----- original message -----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top