Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Gail Gurman
 
Posts: n/a
Default Calculating a Temporary Average

I'm creating a spreadsheet to keep track of my GPA. The grades don't all
come out at the same time, so one or more of the grade cells may be
blank. Each class has a different number of credits and the GPA depends
on multiplying the grade values by the number of credits, adding them all
together, and dividing by the total number of credits:

(G1*C1+...+Gn*Cn)/Sum(C1:Cn) = GPA

My worksheet (for now) looks like this (these grades are samples, of
course):

Class Credits Grade Value* Weighted Value
Subject1 2.0 B 3 9
Subject2 3.0 C 2 6
Subject3 3.0
Subject4 4.0 A 4 12

*This is returned by looking up the grade in an array of grade values.

I don't have the grade for Subject3 yet, but I want to figure out my GPA
so far. So I want to get the sum of the numbers in the "Weighted Value"
column and divide that by the sum of the numbers in the "Credits" column
that are in rows that contain a value in the "Grade" column. For example,
the answer for the above sheet would work out like this:

(9+6+12)/(2+3+4)=3

If this were a computer program, I could do this by having a variable
that gets incremented in a for() loop or something like that, but I'm not
sure how to create an Excel function to do what I want to do.

How can I create a function to get the sum of the numbers in a column for
which there is a corresponding value in another column?

Thanks in advance!

  #2   Report Post  
Gail Gurman
 
Posts: n/a
Default

Gail Gurman wrote in
:
How can I create a function to get the sum of the numbers in a column
for which there is a corresponding value in another column?


I figured out the answer to my own question. The solution is to use SUMIF
(), which sums a range depending on the values in another range.
  #3   Report Post  
Dave Peterson
 
Posts: n/a
Default

I think I'd just add another column:
Earned Credits
=if(c3="","",b3)

C3 holds the grade, B3 holds the potential credits.

But you can use an expression like:

=SUMPRODUCT(B2:B5,--(C2:C5<""))
that will sum the values in B2:B5 only if the corresponding values in C2:C5 are
not empty.

So
=SUM(E2:E5)/SUMPRODUCT(B2:B5,--(C2:C5<""))

would seem to work.



Gail Gurman wrote:

I'm creating a spreadsheet to keep track of my GPA. The grades don't all
come out at the same time, so one or more of the grade cells may be
blank. Each class has a different number of credits and the GPA depends
on multiplying the grade values by the number of credits, adding them all
together, and dividing by the total number of credits:

(G1*C1+...+Gn*Cn)/Sum(C1:Cn) = GPA

My worksheet (for now) looks like this (these grades are samples, of
course):

Class Credits Grade Value* Weighted Value
Subject1 2.0 B 3 9
Subject2 3.0 C 2 6
Subject3 3.0
Subject4 4.0 A 4 12

*This is returned by looking up the grade in an array of grade values.

I don't have the grade for Subject3 yet, but I want to figure out my GPA
so far. So I want to get the sum of the numbers in the "Weighted Value"
column and divide that by the sum of the numbers in the "Credits" column
that are in rows that contain a value in the "Grade" column. For example,
the answer for the above sheet would work out like this:

(9+6+12)/(2+3+4)=3

If this were a computer program, I could do this by having a variable
that gets incremented in a for() loop or something like that, but I'm not
sure how to create an Excel function to do what I want to do.

How can I create a function to get the sum of the numbers in a column for
which there is a corresponding value in another column?

Thanks in advance!


--

Dave Peterson
  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

And the =sumif() solution is nicer.

Dave Peterson wrote:

I think I'd just add another column:
Earned Credits
=if(c3="","",b3)

C3 holds the grade, B3 holds the potential credits.

But you can use an expression like:

=SUMPRODUCT(B2:B5,--(C2:C5<""))
that will sum the values in B2:B5 only if the corresponding values in C2:C5 are
not empty.

So
=SUM(E2:E5)/SUMPRODUCT(B2:B5,--(C2:C5<""))

would seem to work.

Gail Gurman wrote:

I'm creating a spreadsheet to keep track of my GPA. The grades don't all
come out at the same time, so one or more of the grade cells may be
blank. Each class has a different number of credits and the GPA depends
on multiplying the grade values by the number of credits, adding them all
together, and dividing by the total number of credits:

(G1*C1+...+Gn*Cn)/Sum(C1:Cn) = GPA

My worksheet (for now) looks like this (these grades are samples, of
course):

Class Credits Grade Value* Weighted Value
Subject1 2.0 B 3 9
Subject2 3.0 C 2 6
Subject3 3.0
Subject4 4.0 A 4 12

*This is returned by looking up the grade in an array of grade values.

I don't have the grade for Subject3 yet, but I want to figure out my GPA
so far. So I want to get the sum of the numbers in the "Weighted Value"
column and divide that by the sum of the numbers in the "Credits" column
that are in rows that contain a value in the "Grade" column. For example,
the answer for the above sheet would work out like this:

(9+6+12)/(2+3+4)=3

If this were a computer program, I could do this by having a variable
that gets incremented in a for() loop or something like that, but I'm not
sure how to create an Excel function to do what I want to do.

How can I create a function to get the sum of the numbers in a column for
which there is a corresponding value in another column?

Thanks in advance!


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Gail Gurman
 
Posts: n/a
Default

Dave Peterson wrote in
:

And the =sumif() solution is nicer.


Yup. That's what I ended up using.
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
average, array and offsets Darin1979 Excel Worksheet Functions 0 November 17th 04 04:21 PM
Calculating Average Values Using Arithmetic Equations ryangruhn Excel Worksheet Functions 0 November 3rd 04 07:42 PM
Calculating Average Values Using Arithmetic Equations ryangruhn Excel Worksheet Functions 2 November 3rd 04 07:22 PM
Calculating Net Position and Average Price carl Excel Worksheet Functions 6 October 31st 04 01:08 PM
Average Formula Vinaya Excel Worksheet Functions 1 October 29th 04 01:53 PM


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

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

About Us

"It's about Microsoft Excel"