Good question, I can see how it would be confusing. The answer is this: Harry does not get the elder wand from Dumbledore. He gets it from Draco Malfoy. Here is the sequence of events:
1. Grindelwald steals the elder wand.
2. Dumbledore defeats Grindelwald, and the elder wand passes to him (Dumbledore).
3. Draco Malfoy (in book 6) DISARMS Dumbledore, thereby taking the elder wand from Dumbledore by force, unknowingly passing the elder wand power to himself (Draco).
4. In the Malfoy manor (Book 7), Harry Potter DISARMS Draco Malfoy, taking Draco's wand as his own, and thereby passing the elder wand power to himself (Harry).
Unfortunately for Voldemort, the bearer of the elder wand does NOT need to be killed in order to gain the power of the elder wand. It need only be taken by force (as suggested by both Ollivander and Dumbledore in Book 7). Voldemort assumed that because Snape had killed Dumbledore in Book 6, that the power of the wand passed to Snape, which is why Voldemort had Snape killed. However, as Harry learns when he speaks with Dumbledore in "the misty place", Snape did not disarm Dumbledore - DRACO disarmed Dumbledore, thus ensuring the power of the elder wand passed to Draco. So when Harry disarmed Draco in the Malfoy manor while rescuing Hermione, Ollivander, and Luna, etc. the power of the elder wand passed to Harry through Draco's wand. Draco's wand switched allegiance to Harry. Like Hermione always says - it's not the wand, it's the wizard behind it.
I hope this helps clear things up for you!