About VLOOKUP in Excel (Find all grades and calculate the GPA)

ryo89589

New Member
Joined
Jul 29, 2019
Messages
1
Hi, everyone. I found a problem in Excel. Can any better method be used to calculating two GPA (E2 and E7 in the following)?

Example:
Table A:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Year[/TD]
[TD]Subject Title[/TD]
[TD]Credits[/TD]
[TD]Grade[/TD]
[TD]GPA[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Subject1[/TD]
[TD]1[/TD]
[TD]A+[/TD]
[TD]3.57[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Subject2[/TD]
[TD]2[/TD]
[TD]A[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Subject3[/TD]
[TD]3[/TD]
[TD]A-[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Subject4[/TD]
[TD]3[/TD]
[TD]B+[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Subject5[/TD]
[TD]2[/TD]
[TD]B[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Subject6[/TD]
[TD]3[/TD]
[TD]B-[/TD]
[TD]2.33[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Subject7[/TD]
[TD]3[/TD]
[TD]C+[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Subject8[/TD]
[TD]3[/TD]
[TD]C[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Table B:
[TABLE="width: 144"]
<tbody>[TR]
[TD="class: xl69, width: 144, colspan: 2"]GPA[/TD]
[/TR]
[TR]
[TD="class: xl65"]A+[/TD]
[TD="class: xl66, align: right"]4.3[/TD]
[/TR]
[TR]
[TD="class: xl65"]A[/TD]
[TD="class: xl66, align: right"]4[/TD]
[/TR]
[TR]
[TD="class: xl65"]A-[/TD]
[TD="class: xl66, align: right"]3.7[/TD]
[/TR]
[TR]
[TD="class: xl65"]B+[/TD]
[TD="class: xl66, align: right"]3.3[/TD]
[/TR]
[TR]
[TD="class: xl65"]B[/TD]
[TD="class: xl66, align: right"]3[/TD]
[/TR]
[TR]
[TD="class: xl65"]B-[/TD]
[TD="class: xl66, align: right"]2.7[/TD]
[/TR]
[TR]
[TD="class: xl65"]C+[/TD]
[TD="class: xl66, align: right"]2.3[/TD]
[/TR]
[TR]
[TD="class: xl65"]C[/TD]
[TD="class: xl66, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl65"]C-[/TD]
[TD="class: xl66, align: right"]1.7[/TD]
[/TR]
[TR]
[TD="class: xl65"]D+[/TD]
[TD="class: xl66, align: right"]1.3[/TD]
[/TR]
[TR]
[TD="class: xl65"]D[/TD]
[TD="class: xl66, align: right"]1[/TD]
[/TR]
[TR]
[TD="class: xl65"]D-[/TD]
[TD="class: xl66, align: right"]0.7[/TD]
[/TR]
[TR]
[TD="class: xl67"]F[/TD]
[TD="class: xl68, align: right"]0[/TD]
[/TR]
</tbody>[/TABLE]

Now, I am using following formulas in Table A:
E2=3.57=
Code:
=ROUND((C2*VLOOKUP(D2,G3:H15,2,FALSE)+C3*VLOOKUP(D3,G3:H15,2,FALSE)+C4*VLOOKUP(D4,G3:H15,2,FALSE)+C5*VLOOKUP(D5,G3:H15,2,FALSE)+C6*VLOOKUP(D6,G3:H15,2,FALSE))/SUM(C2:C6),2)
E7=2.33=
Code:
=ROUND((C7*VLOOKUP(D7,G3:H15,2,FALSE)+C8*VLOOKUP(D8,G3:H15,2,FALSE)+C9*VLOOKUP(D9,G3:H15,2,FALSE))/SUM(C7:C9),2)
Have any better method (reduce VLOOKUP) can be used? Thank you!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Try this array formula:

But in column A you must fill all the cells with the year. Put the cell in E2 and the copies in E7.

<table border="1" cellspacing="0" style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:76.04px;" /><col style="width:115.96px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >A</td><td >B</td><td >C</td><td >D</td><td >E</td><td >F</td><td >G</td><td >H</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >1</td><td style="background-color:#92d050; ">Year</td><td style="background-color:#92d050; ">Subject Title</td><td style="background-color:#92d050; ">Credits</td><td style="background-color:#92d050; ">Grade</td><td style="background-color:#92d050; ">GPA</td><td > </td><td > </td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >2</td><td style="text-align:right; ">1</td><td >Subject1</td><td style="text-align:right; ">1</td><td >A+</td><td style="text-align:right; ">3.57</td><td > </td><td colspan="2" style="background-color:#ffc000; text-align:center; ">GPA</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >3</td><td style="text-align:right; ">1</td><td >Subject2</td><td style="text-align:right; ">2</td><td >A</td><td > </td><td > </td><td >A+</td><td style="text-align:right; ">4.3</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >4</td><td style="text-align:right; ">1</td><td >Subject3</td><td style="text-align:right; ">3</td><td >A-</td><td > </td><td > </td><td >A</td><td style="text-align:right; ">4</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >5</td><td style="text-align:right; ">1</td><td >Subject4</td><td style="text-align:right; ">3</td><td >B+</td><td > </td><td > </td><td >A-</td><td style="text-align:right; ">3.7</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >6</td><td style="text-align:right; ">1</td><td >Subject5</td><td style="text-align:right; ">2</td><td >B</td><td > </td><td > </td><td >B+</td><td style="text-align:right; ">3.3</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >7</td><td style="text-align:right; ">2</td><td >Subject6</td><td style="text-align:right; ">3</td><td >B-</td><td style="text-align:right; ">2.33</td><td > </td><td >B</td><td style="text-align:right; ">3</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >8</td><td style="text-align:right; ">2</td><td >Subject7</td><td style="text-align:right; ">3</td><td >C+</td><td > </td><td > </td><td >B-</td><td style="text-align:right; ">2.7</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >9</td><td style="text-align:right; ">2</td><td >Subject8</td><td style="text-align:right; ">3</td><td >C</td><td > </td><td > </td><td >C+</td><td style="text-align:right; ">2.3</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >10</td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td >C</td><td style="text-align:right; ">2</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >11</td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td >C-</td><td style="text-align:right; ">1.7</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >12</td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td >D+</td><td style="text-align:right; ">1.3</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >13</td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td >D</td><td style="text-align:right; ">1</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >14</td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td >D-</td><td style="text-align:right; ">0.7</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >15</td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td >F</td><td style="text-align:right; ">0</td></tr></table><br /><table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00;background-color:#fffcf9; color:#000000; "><tr><td ><b></b></td></tr><tr><td ><table border = "1" cellspacing="0" cellpadding="2" style="font-family:Arial; font-size:9pt;"><tr style="background-color:#cacaca; font-size:10pt;"><td >Cell</td><td >Formula</td></tr><tr><td >E2</td><td >{=ROUND(SUM(IFERROR(IF($A$2:$A$9=A2,$C$2:$C$9)*IF(ISNUMBER(SEARCH(IF($A$2:$A$9=A2,$D$2:$D$9),$G$3:$G$15)),$H$3:$H$15),0))/SUM(IF($A$2:$A$9=A2,$C$2:$C$9)),2)}</td></tr></table></td></tr></table>

Array formulas
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself
 
Upvote 0

Forum statistics

Threads
1,225,628
Messages
6,186,103
Members
453,337
Latest member
fiaz ahmad

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