I don't really understand why unit analysis works.
I found a simple example on a website (I can post the link in a comment if you want). It says, For example, convert 18 grams of water to moles. The molar mass of water is 18 g/mol; therefore : 18g H2O x 1