You don't explain what you want your formula to do, so it's hard to say how to correct it.
However, it appears from context that for each product, you want to multiply the quantity times the unit cost to get a total cost for that product, and then sum the total costs for all the products. The SUMPRODUCT function is perfect for this:
I'll take a moment to explain why your formula doesn't work. IF has three parts: The condition, the result if the condition is TRUE, and the result if the condition is FALSE. You have nested many IF functions together, so as soon as one of the conditions is TRUE it returns the TRUE result and finishes. There is nothing in your formula to add the results. For example, if G6 is a number, the formula returns G6*G1 and then it's done.
You don't have to worry about the cells that are blank. When Excel does arithmetic, it will treat a blank cell as 0.
Bookmarks