lundi 12 octobre 2020

Simplifying complex IF + COUNTIF + INDEX formula

So this formula I inherited I feel is garbage but I'm unsure how to simplify or improve it. =IF(D311>0.9,IF((COUNTIF(INDEX(D$1:D310,$B179):D310,2))/(COUNTIF(INDEX(D$1:D310,$B179):D310,">.5"))>$F$178,B$1,""),"")

So to break it down here's what it's trying to do.

Check to see if D311 is greater than .9 If it is then do the following things

  1. Scan within a range for how many times '2' appears. The range specified should end at D310 and should start at D(indicated by B179).

  2. Scan within a range for how many numbers are greater than '.5'. The range specified should end at D310 and should start at D(indicated by B179).

  3. Take the answer to '1.' and divide by answer '2.'.

  4. If the answer to '3.' is greater than F178 then display B1 else display nothing.

This formula results sometimes in #DIV/0! error if the answer to '1.' and '2.' are both 0 which might be a separate issue I'm not sure.

Aucun commentaire:

Enregistrer un commentaire