It's called Manhattan Distance and can easily be computed by:
distance = abs(ydistance) + abs(xdistance)
That is, the number of cells you must travel vertically, plus the number of cells you must travel horizontally, much like a taxi driving through a grid of city streets.