Ok, i trust I have not made a complete fool of myself...did not see the Petrol/ gas part.
ito oil analysis, yes, you do get results but you need to benchmark them to a known comparable operation. That will show deviances from a known "norm". Further, it is useful to trend your gearbox's history to show things getting worse or stabilizing. Therefore the custom to draw a sample, analyse first and dependant upon the outcome either drain, top up or extend the drain interval.
This methodology is good for determining "best suited" oils for the particular working conditions that you experience (as you can determine the "additive pack depletion rate")
All good and well for a large fleet operator. For a one vehicle - one man type role oil analysis is expensive and technically challenging. Therefore the modus operandi of changing every 40 kkm as a "best fit - least risk" approach. (exactly the same for engine and other oils).
As to your question "Would an oil analysis has detected problems before I bought it?" the answer depends on when the sample is drawn. Fresh oil should not show any abnormalities. Overdue used oil will show high counts of metal particles (without the benchmark or trend - this is difficult to quantify as to the mechanical condition of the gearbox) ((and normally you have no idea of what oil was used last for the fill - therefore will not know the additive pack start point))
Short answer is probably not