To find how many batteries you need, divide the energy you require (in watt-hours) by the usable energy of one battery (Ah × V × depth of discharge), then round up: Batteries = ceil(Wh ÷ (Ah × V × DoD)). If you need 5,000 Wh and each battery is 100Ah 12V lithium at 80% depth of discharge, one battery gives 960 usable Wh, so 5,000 ÷ 960 = 5.2, which rounds up to 6 batteries. The calculator above does this instantly and shows the usable energy per battery and the total bank energy.
You always round up because a partial battery cannot store your full requirement — five batteries would fall short. The two biggest factors are the battery's usable energy (which depends heavily on chemistry and depth of discharge) and how much margin you build in for aging, cold, and future loads.