If you look at the first two rows of the table, and replace each entry with its current value mod 12 (the remainder when divided by 12) you will get:
1 2 3 4 5 6 7
---------------------------------
4 5 6 7 8 9
3 2 1 0 11 10
Now 5018 mod 12 = 2 so 5018 lands under column 3.
To compute modulo 12 on a calculator (assuming it does not have a 'mod' button), divide 5018 by 12 as normal, then subtract the whole number portion from the result. Multiply the decimal portion (which is the remainder) by 12 to get an integer.