I came across this post that detailed how to find out the percentage charge that's left in a AA battery ( formula:(voltage-1)*200 ). What's the formula for a AAA battery, CR2023, or a 9V battery?
That formula is inaccurate for alkaline and other primary (non-rechargeable) cells. Something similar works fairly well for linear-discharge rechargeable cells like lead-acid or nickel cadmium but not for those with non-linear discharge curves like lithium-ion (electronic devices like cell phones and laptops) and lithium iron phosphate (power tools and electric cars).
For alkalines and such, you need to test voltage under load, and the correct load varies with cell size (and type; back in carbon-zinc days, "photoflash" batteries would source much more current than regular flashlight cells, but didn't last as long under discharge). Voltage without load with these cell types is determined more by the actual chemistry than by the remaining charge (for instance, a zinc-air hearing aid cell will be 1.35 V, typical carbon-zinc or alkaline are 1.5, and silver oxide are 1.55 V per cell).
If you have a reference for the correct load test current, you can use a resistor to load the cell and measure voltage across the terminals, refer to a chart, and get a very close estimate of the remaining capacity. Otherwise, what you'll get with a multimeter on the battery terminals will be little better than "dead" or "not dead".
@Zeiss answer implies that there is no lifehack solution, and you need to do it "properly". While formally true — the linear formula is rarely accurate and even when it is, the values need adjustments for each type of battery — there is a way to work around it to some extent.
The truly lifehack solution is the lick test. Yes, you just need to lick the battery terminals — both at once, of course. The current going through your tongue will cause a tingy sensation which is somewhat proportional to the voltage. With experience, you'll be able to tell at least between "fresh", "OK" and "nearly dead" states. This is how we did it before multimeters became ubiquitous :)
This works best for button cell batteries (just don't swallow it accidentally). It's not that easy with AA/AAA and similar batteries: you'll need a short wire, or better a flat tin or aluminium strip to make a better contact.
9V is quite stingy (but still safe), so be prepared. 3V (CR2032 etc.) is comfortable and offers the best resolution (for me). 1.5V is fairly weak and, especially given different initial voltages of different types, it's better to have a guaranteed fresh battery of the same kind at hand to "calibrate yourself". (The sensation will depend on the amount of saliva and even on what you've eaten).