Zend certified PHP/Magento developer

Given two columns, Insert a value at a specific position in excel

Situation:

Screenshot of cells

I have two columns A and B. I want the third column C based on the position (specified by B) of the values (specified by A). For empty cells in C, I want to have 0.

How can I do this in Excel?

I tried with INDEX and VLOOKUP functions, but without success.