Difficult to get a grasp of your method, because w need more info.
The 3D cursor is just a tool to have a fixed point in space beside the world one 0,0,0.
If you do math in object mode, you are basically working with the origin point. The virtual center of the object. But it can have any location you need or want it.
In edit mode, you manipulate the mesh of the object, but the origin stays unchanged. Moving the mesh is basically moving the object. Because the origin point stays at the same WORLD location. But the object’s content (the mesh) has transformed.
While moving the origin point in OBJECT MODE, the mesh stays in place.
The reason for us being confused is that “y / 2” does something half, but half of what?
If the origin point is in the middle of Y, then yes “y/2” could work. But we don’t know your object (mesh and location or the origin point).
Remember there are many possible solutions for Blender situations. There is no real right or wrong. The end results count. It’s more or less how efficient it can be done. And that takes practice and experience.