A laptop battery is not just a battery pack.
There is a logic board inside the battery that interfaces with the laptop to control and monitor the charging and condition of the battery.
You can have perfectly good cells in the battery but the logic board in the pack is fubar and it won't let the cells charge - or it won't properly report the condition of the battery to the laptop so the laptop won't send a charge.
[This would mean replace the battery.]
That logic board interfaces with one in the charging circuit inside the laptop.
Problems with that circuit can result in the same problems as the other.
[This generally means a motherboard replacement although some (not most) laptops have this circuit on a daughter board that can be replaced without replacing the main board.]
Both of these circuits have controls built into the BIOS code.
Sometimes (although not often) a BIOS update can fix these problems.
If this laptop is under warranty you should contact Dell.
~~
Just FYI, future reference:
LI batteries go bad in 2 to 4 years even if you never use them.
It's a function of their chemistry.
They do NOT have a memory affect like NiMH batteries but discharging them too far is considered bad for them.
.