11.08.2013 Views

Excel's Formula - sisman

Excel's Formula - sisman

Excel's Formula - sisman

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 8: Using Lookup Functions 225<br />

without using a lookup table. Rather, the information in the lookup table is hard-coded into an<br />

array constant. See Chapter 14 for more information about array constants.<br />

=VLOOKUP(B2,{0,”F”;40,”D”;70,”C”;80,”B”;90,”A”},2)<br />

Another approach, which uses a more legible formula, is to use the LOOKUP function with two<br />

array arguments:<br />

=LOOKUP(B2,{0,40,70,80,90},{“F”,”D”,”C”,”B”,”A”})<br />

Finally, whenever you can easily convert your input, the number grade in this case, into the integers<br />

1 to 254, the CHOOSE function becomes an option. The number grades are divided by 10,<br />

the decimal is stripped off, and 1 is added to it to produce the numbers 1 to 11. The remaining<br />

arguments define the return values for those 11 options.<br />

=CHOOSE(TRUNC(B2/10)+1,”F”,”F”,”F”,”F”,”D”,”D”,”D”,”C”,”B”,”A”,”A”)<br />

Calculating a grade point average<br />

A student’s grade point average (GPA) is a numerical measure of the average grade received for<br />

classes taken. This discussion assumes a letter grade system, in which each letter grade is<br />

assigned a numeric value (A=4, B=3, C=2, D=1, and F=0). The GPA comprises an average of the<br />

numeric grade values, weighted by the credit hours of the course. A one-hour course, for example,<br />

receives less weight than a three-hour course. The GPA ranges from 0 (all Fs) to 4.00<br />

(all As).<br />

Figure 8-11 shows a worksheet with information for a student. This student took five courses, for<br />

a total of 13 credit hours. Range B2:B6 is named CreditHours. The grades for each course appear<br />

in column C (Range C2:C6 is named Grades). Column D uses a lookup formula to calculate the<br />

grade value for each course. The lookup formula in cell D2, for example, follows. This formula<br />

uses the lookup table in G2:H6 (named GradeTable).<br />

=VLOOKUP(C2,GradeTable,2,FALSE)<br />

Figure 8-11: Using multiple formulas to calculate a GPA.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!