Entensions from Binary Data

Is there any way to figure out the type of a file by just looking at the binary data? I tried using the magic number binary signatures, but they only distinguish if a file is a new or old Microsoft document or another type like a .tif. They don't distinguish .xlsx from .docx.