Charlotte here for the team! Happy to help out with this!
So you won’t be able to exclude certain items and groups from this formula but you can use an IF formula to return a specific value or text (e.g. “N/A”) in the cells where there is no correlating value in the “cost with sides” column.
You can learn more about IF formulas here and different use cases here.
Alternatively, if you want to keep your formula as it is, you could use conditional coloring to specifically color cells where there is a value: