|It is probable that the charging cord is no longer supplying the full power needed to power the system but is at least able to partially charge the battery. If the battery does not charge fully or it takes a long time to charge, this may confirm it.|
It is also possible that the charging circuit (power board I believe), is going and is causing the issue, which may be indicated by the ability to charge but not power it without the battery present.
If you know anyone with a similar HP laptop, borrow their charging cord and see if that proves either possibility above.
It is not the battery since then it would run with the battery removed.
With your prior issue, you might have been able to do a start up repair with your install disk, recovery disk or a repair disk. That is of course is too late for now and as long as the hard drive took formatting and reinstalling, is not related to this problem.
You have to be a little bit crazy to keep you from going insane.