Assuming the SubID number you want to find the day value for is in a cell such as D1 then the formula could be: =IFERROR(AGGREGATE(15,6,B2:B5/(A2:A5=D1)/(C2:C5="Charge"),1),AGGREGATE(14,6,B2:B5/(A2:A5=D1)/(C2:C5<>"Charge"),1))
=IFERROR(AGGREGATE(15,6,B2:B5/(A2:A5=D1)/(C2:C5="Charge"),1),AGGREGATE(14,6,B2:B5/(A2:A5=D1)/(C2:C5<>"Charge"),1))