Asking whether a gram is bigger than an hour is physically meaningless
You can compare metres with feet, or seconds with years, because each pair measures the same kind of thing. But grams and hours belong to different dimensions, so no conversion links them. Tracking those dimensions, an idea Joseph Fourier introduced in 1822, lets scientists catch nonsense equations before doing any real calculation.
Every physical quantity can be broken into powers of a few basic dimensions, such as length, mass and time. Velocity is length divided by time. Acceleration divides by time again. Force is mass times acceleration, energy is force times distance, and power is energy per unit of time. The dimension is deeper than the unit: mass stays mass whether you measure it in kilograms or pounds, and the choice of unit is often a historical accident. A conversion factor such as 2.54 centimetres per inch is really just a disguised version of the number one, so multiplying by it changes nothing.
The central rule is dimensional homogeneity. Any physically meaningful equation must have matching dimensions on both sides, just as you cannot sensibly set a speed equal to a weight. Checking this is a quick plausibility test for a derived formula, and it can even guide the discovery of equations when a full derivation is out of reach.
Lord Rayleigh turned that guidance into a recipe. List the variables likely to affect the quantity you care about, assume it equals a dimensionless constant times each variable raised to some unknown power, then demand that the dimensions balance. The result is a set of simple equations for the exponents. The more general Buckingham π theorem shows that any meaningful relationship among n variables can be rewritten using fewer quantities that carry no dimensions at all, and it gives a way to compute them.
Stripping dimensions out of an equation in this way, by scaling against the system's natural units or physical constants, often reveals which features truly govern its behaviour. Some physicists even question whether truly separate fundamental dimensions exist, though that doubt has not dented the technique's usefulness.
Source: Dimensional analysis