Typically we get an unknown (organic) compound, and it contains #C,H,N,O#. We combust a known mass in a furnace, and the combustion products, #CO_2#, #H_2O#, and #NO_2# are shunted to a gas chromatograph, and the #%C, %H, %N# are delivered.
We can thus get a an empirical formula of the kind, #C_nH_mN_oO_p# (typically, oxygen is the missing percentage if #%C, %H, %N# do NOT sum to #100%#). And the empirical formula is the simplest whole number ratio that represents constituent atoms in a species. So we have the empirical formula, and we need a determination of molecular weight, before we approach the molecular formula:
i.e. #"Molecular formula "=# #nxx("Empirical formula")#, and thus we solve for #n# to get the molecular formula.
Here is one example.