You mean the #"empirical formula"...........#
The #"empirical formula"# is the simplest whole number defining constituent atoms in a species. And it is calculated by taking percentage mass of each element, and dividing thru by atomic mass, and then modifying these percentages to give simple whole numbers.
And thus #%Ba# #=# #(17.14*g)/(17.14*g+8.86*g)xx100%=65.9%#
And thus #%Cl# #=# #(8.86*g)/(17.14*g+8.86*g)xx100%=34.1%#
You will note of course that the percentages sum to #100%#. Why #"of course?"#
And then we assume #100*g# of compound and divide thru by the atomic masses of each constituent:
#"Moles of barium"# #=# #(65.9*g)/(137.3*g*mol^-1)=0.480*mol.#
#"Moles of chlorine"# #=# #(34.10*g)/(35.5*g*mol^-1)=0.960*mol.#
If we divide thru by the smallest molar quantity, CLEARLY, we get an empirical formula of #BaCl_2#...........