lezawang
Well-known Member
- Joined
- Mar 27, 2016
- Messages
- 1,805
- Office Version
- 2016
- Platform
- Windows
Hi
I use vlookup to find the grade of each student (last argument is TRUE). My question why the grade table "has to" be sorted from smallest to the largest otherwise vlookup wont work. It wont work if the table was like this
[TABLE="class: grid, width: 128"]
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64, align: right"]90[/TD]
[TD="width: 64"]a[/TD]
[/TR]
[TR]
[TD="align: right"]70[/TD]
[TD]b[/TD]
[/TR]
[TR]
[TD="align: right"]60[/TD]
[TD]c[/TD]
[/TR]
[TR]
[TD="align: right"]50[/TD]
[TD]d[/TD]
[/TR]
[TR]
[TD="align: right"]0[/TD]
[TD]f[/TD]
[/TR]
</tbody>[/TABLE]
Below, it will work because the grade table sorted from smallest to the largest
[TABLE="class: grid, width: 576"]
<colgroup><col width="64" span="9" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]name[/TD]
[TD="width: 64"]test[/TD]
[TD="width: 64"]test[/TD]
[TD="width: 64"]test[/TD]
[TD="width: 64"]average[/TD]
[TD="width: 64"]grade[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD]john1[/TD]
[TD="align: right"]18[/TD]
[TD="align: right"]30[/TD]
[TD="align: right"]35[/TD]
[TD="align: right"]28[/TD]
[TD]f[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]alex1[/TD]
[TD="align: right"]65[/TD]
[TD="align: right"]78[/TD]
[TD="align: right"]76[/TD]
[TD="align: right"]73[/TD]
[TD]b[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD]f[/TD]
[/TR]
[TR]
[TD]mary1[/TD]
[TD="align: right"]18[/TD]
[TD="align: right"]79[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]37[/TD]
[TD]f[/TD]
[TD][/TD]
[TD="align: right"]50[/TD]
[TD]d[/TD]
[/TR]
[TR]
[TD]david1[/TD]
[TD="align: right"]90[/TD]
[TD="align: right"]90[/TD]
[TD="align: right"]99[/TD]
[TD="align: right"]93[/TD]
[TD]a[/TD]
[TD][/TD]
[TD="align: right"]60[/TD]
[TD]c[/TD]
[/TR]
[TR]
[TD]sarah1[/TD]
[TD="align: right"]61[/TD]
[TD="align: right"]94[/TD]
[TD="align: right"]45[/TD]
[TD="align: right"]67[/TD]
[TD]c[/TD]
[TD][/TD]
[TD="align: right"]70[/TD]
[TD]b[/TD]
[/TR]
[TR]
[TD]john2[/TD]
[TD="align: right"]20[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]73[/TD]
[TD]b[/TD]
[TD][/TD]
[TD="align: right"]90[/TD]
[TD]a[/TD]
[/TR]
[TR]
[TD]alex2[/TD]
[TD="align: right"]30[/TD]
[TD="align: right"]26[/TD]
[TD="align: right"]37[/TD]
[TD="align: right"]31[/TD]
[TD]f[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I use vlookup to find the grade of each student (last argument is TRUE). My question why the grade table "has to" be sorted from smallest to the largest otherwise vlookup wont work. It wont work if the table was like this
[TABLE="class: grid, width: 128"]
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64, align: right"]90[/TD]
[TD="width: 64"]a[/TD]
[/TR]
[TR]
[TD="align: right"]70[/TD]
[TD]b[/TD]
[/TR]
[TR]
[TD="align: right"]60[/TD]
[TD]c[/TD]
[/TR]
[TR]
[TD="align: right"]50[/TD]
[TD]d[/TD]
[/TR]
[TR]
[TD="align: right"]0[/TD]
[TD]f[/TD]
[/TR]
</tbody>[/TABLE]
Below, it will work because the grade table sorted from smallest to the largest
[TABLE="class: grid, width: 576"]
<colgroup><col width="64" span="9" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]name[/TD]
[TD="width: 64"]test[/TD]
[TD="width: 64"]test[/TD]
[TD="width: 64"]test[/TD]
[TD="width: 64"]average[/TD]
[TD="width: 64"]grade[/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[TD="width: 64"][/TD]
[/TR]
[TR]
[TD]john1[/TD]
[TD="align: right"]18[/TD]
[TD="align: right"]30[/TD]
[TD="align: right"]35[/TD]
[TD="align: right"]28[/TD]
[TD]f[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]alex1[/TD]
[TD="align: right"]65[/TD]
[TD="align: right"]78[/TD]
[TD="align: right"]76[/TD]
[TD="align: right"]73[/TD]
[TD]b[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD]f[/TD]
[/TR]
[TR]
[TD]mary1[/TD]
[TD="align: right"]18[/TD]
[TD="align: right"]79[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]37[/TD]
[TD]f[/TD]
[TD][/TD]
[TD="align: right"]50[/TD]
[TD]d[/TD]
[/TR]
[TR]
[TD]david1[/TD]
[TD="align: right"]90[/TD]
[TD="align: right"]90[/TD]
[TD="align: right"]99[/TD]
[TD="align: right"]93[/TD]
[TD]a[/TD]
[TD][/TD]
[TD="align: right"]60[/TD]
[TD]c[/TD]
[/TR]
[TR]
[TD]sarah1[/TD]
[TD="align: right"]61[/TD]
[TD="align: right"]94[/TD]
[TD="align: right"]45[/TD]
[TD="align: right"]67[/TD]
[TD]c[/TD]
[TD][/TD]
[TD="align: right"]70[/TD]
[TD]b[/TD]
[/TR]
[TR]
[TD]john2[/TD]
[TD="align: right"]20[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]73[/TD]
[TD]b[/TD]
[TD][/TD]
[TD="align: right"]90[/TD]
[TD]a[/TD]
[/TR]
[TR]
[TD]alex2[/TD]
[TD="align: right"]30[/TD]
[TD="align: right"]26[/TD]
[TD="align: right"]37[/TD]
[TD="align: right"]31[/TD]
[TD]f[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]