Here is a link describing reshaping data using Custom SQL
If you can reshape your original datasource, you can use the Tableau plug-in for Excel.
It should accomplish what you need.
When you hit the Reshape Data icon,
you can then select the cell marked in red below,
and it should yield what you need.