You use Mod and \ operators. Index = X + Y * ItemsInRow X = Index Mod ItemsInRow Y = Index \ ItemsInRow
Forum Rules