Typically there is a Dell app which will tell you the battery health. You should find it on your taskbar. Right click and select
Dell Power Manager. Some batteries also have a button which will indicate battery health when pressed via 1-5 LEDs.
Dell power cables also have a
sense wire which is prone to breaking with repeated flexing. When it breaks your computer can no longer tell what type of battery it is talking to.
Finally, if the problem is with a motherboard component (connector or otherwise) a new battery may not help. This was the case with my Inspiron 1720. I replaced the battery and it still wouldn't charge. Fortunately it still works just fine on AC power.