# IF statements going wrong

I have a client who is using if statements to find out totals of sales stats for each of their sales people. When he uses an IF statement within a SUM formula it works fine by picking up the sales person and summing their figures, but when he tries to put an IF statement in any of the other formulas it does not give the right infomation....using formulas in the form {=AVERAGE(IF(A4:A11=A2, B4:B11, 0))}

A                       B
Salesperson1

Salesperson1      13
Salesperson1      15
Salesperson1      16
Salesperson1      23
Salesperson2      3
Salesperson2      3
Salesperson2      3
Salesperson2      3

67      SUM(IF(A4:A11=A2, B4:B11, 0))
8      AVERAGE(IF(A4:A11=A2, B4:B11, 0))
8      COUNT(IF(A4:A11=A2, B4:B11, 0))
23      MAX(IF(A4:A11=A2, B4:B11, 0))
0      MIN(IF(A4:A11=A2, B4:B11, 0))

does this make sense to anyone?

LVL 17
###### Who is Participating?

x

Commented:
Excel has specific formula to use for goal your trying to acheive, try using

sumif
daverage
countif
dmax
dmin

They allow you to specify criteria to apply to the sum, count, etc

Let me know if you need help with the syntax of these

Nat
0

Author Commented:
sorry this should have been in the excel topic area... passing information on... thanks
0

Author Commented:
That worked great thank you.
0

Commented: