Formula for calculating bitcoin transaction size doesn't always work out but why
What am I missing?



Public keys can be compressed or uncompressed
Signature can has slightly different size


And yes, Murch is right in his comment. The formula works only for p2pkh inputs and p2pkh outputs. No p2sh, no segwit, no anything except p2pkh