Thanks very much for your replyI will try to explain a simplified version of what I am trying to do (limited space here) its actually rather simple I am just not an expert on xsl.First: I am trying to calculate item stock resupplyExample 1: if I say YES to items I want the calculation to only add the highest number in the categoryYES on Item 1 = 5YES on Item 2 = 8YES on Item 3 = 15Answer should be 15 (highest number)NO on Item 1 = 5NO on Item 2 = 8NO on Item 3 = 15Answer should be 28 (all added)Example 2: if I say NO to items I want the calculation to add ALL the items