You will be better off using Infopath if you have it. You could then use a combination of rules and XPath functions to accomplish your goal. This might not be an easy process though as it could require some programming knowledge.
Look at the last two pages of this document. It talks about calculating fields.
Blog on Conditional Values/Xpath in Infopath
Tutorial on XPath