View Single Post
  #5   Report Post  
Harlan Grove
 
Posts: n/a
Default

Peo Sjoblom wrote...
If you meant either of TU or ANA36

=AVERAGE(IF((LEFT(A2:A640,2)="TU")+(LEFT(A2:A640, 5)="ANA36"),B2:B640))

....

Which means you're comparing A2:A640 to both TU and ANA36. One way
around that would be

=AVERAGE(IF(LEFT(A2:A640,2)="TU",1,LEFT(A2:A640,5) ="ANA36"),B2:B640)

Another alternative, which scales better if there were several more
values to match, would be

=SUM(SUMIF(A2:A640,{"TU","ANA36"}&"*",B2:B640))
/SUM(COUNTIF(A2:A640,{"TU","ANA36"}&"*"))