I hope I get what you are trying to do ?! Is it a spacial partitioning system, like a cell grid or a quad tree ?!
In this case, if you put objects into a cell based on the minimum and maximum values of the their bounding box/rectangle (I guess center of it), than simply the same way as you put in, calculate the center of the box and divide these values with the width and height of the cells.
Pseudo warning (generally the same in 3d with one extra scalar calculation):
// The grid:
Cell[][] cells;
int cellWidth, cellHeight; // in world size!
// Get a cell based on the bounding box/rectangle of an object:
Rectangle r = object.getBoundingRectangle();
Vector2 center = (r.Minimum + r.Maximum) / 2;
// Here you get the location in the cell coordinate system:
int x = center.X / cellWidth;
int y = center.Y / cellHeight;
if ((x < 0 || x > cells.GetDimension(0)) || (y < 0 || y > cells.GetDimension(1)))
{
// it's center is not in any cells, oops...
}
Cell cell = cells[x][y];
If you are looking for all the cells the rect/box overlaps, do the same division for the minimum and maximum coordinate. That way you get the cell with the minimum and maximum indices from the overlapping cells...