MS Access - Identify highest 3 values across columns -


i have table containing data following:

id    team1    team2    team3    team4    team5    team6 1     5        0        1        2        3        1 3     1        4        0        2        4        1 5     0        0        4        2        1        1 6     4        1        1        2        0        0 

i want derive 3 new columns data 1st, 2nd , 3rd highest values across columns, so:

id    team1    team2    team3    team4    team5    team6   top1  top2   top3 1     5        0        1        2        3        1       5      3      2 3     1        4        0        2        4        1       4      4      2 5     0        0        4        2        1        1       4      2      1 6     4        1        1        2        0        0       4      2      1 

is possible in access? want rank them equal values ranked incrementally, example:

id     value   rank 3      4       1 3      4       2 3      2       3 3      1       4 3      1       5 

i'm open using vba if there way achieve through means. data available unpivoted if it's easier pull out top 3 values in format.

sample of unpivoted data:

id    team    score 1     team1   5 1     team3   1 1     team4   2 1     team5   3 1     team6   1 3     team1   5 3     team2   4 3     team4   2 3     team5   4 3     team1   1 

take function (from finding max of 3 inputs vba)

sub maxthree()   'calculates maximum of 3 numbers'   dim x, y, z single   x = inputbox("enter first number!")   y = inputbox("enter second number!")   z = inputbox("enter third number!")   msgbox ("x: " & x & " y: " & y & " z: " & z)   if x > y       if x > z           msgbox ("the maximum : " & x)       else         msgbox ("the maximum : " & z)       end if   else       if y > z           msgbox ("the maximum : " & y)       else           msgbox ("the maximum : " & z)       end if   end if   end sub   

adjust return highest value (rather display in msgbox). construct 2 additional functions second , third value.

use function in sql query columns want,

good luck.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -