The easiest way to do grid style placement is probably to grab the object position, seperate the Vector X,Y,Z and use "Float Round to nearest" on your chosen floats (i.e. forcing "X" to round to nearest 5.0) followed by "Set Position". You'll notice this method doesn't actually use a physical grid, it just forces placement based on float restrictions.
Now, you might need that physical grid for other things, and your current method works for that, but it's rather expensive. You're looping through every value in the array and testing it's distance from your object to determine the closest point. Instead, you can keep the array, and work out which index in your array your object is at based on it's position (after you've rounded it using the method above).
x = object position X axis
tsx = tilesize X (distance between grid points X axis)
y = Object Position Y axis
tsy = tilesize Y (distance between grid points Y axis)
cols = number of columns in your grid
((y / tsy) * cols)) + (x / tsx) = index
Note: Your array must start at index 0 for this to work.