Link to home
Start Free TrialLog in
Avatar of Bright01
Bright01Flag for United States of America

asked on

Wrong formula being used

EE Pros,

I have a "Gap" column that represents the difference between two other columns.  Each Gap has a associated number, 1-5 that is related to one of 3 Categories -- MIX, TODAY, TOMORROW. If we fix one formula, I can fix all the rest.  The formula now uses index and match.  What I need it to do is Index, count the occurances (of each number assigned (i.e. 1-5) and create an average related to the indexed numbers divided by the occurances.  I don't think it does that now as you will see by my sample attached.  I think the formula must be different to get the right result.

Thank you in advance.

B.
INCORRECT-FORMULA.xlsm
Avatar of Flyster
Flyster
Flag of United States of America image

You can use a combination of sumif/countif. Try this formula in K4:

=SUMIF(F3:F27,I4,E3:E27)/COUNTIF(F3:F27,I4)

Copy and paste down to K8.

Flyster
I don't understand why you think the average should be 0.9 for cell K4. There are three instances of a "1" in column F. The corresponding values from column C are 2.4, 2.0 and 1.6. The average of those is 2.0.

This formula returns it (and may be copied across and down):
=AVERAGEIF($F$3:$F$27,$I4,C$3:C$27)
SOLUTION
Avatar of Flyster
Flyster
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bright01

ASKER

Great work guys.  I think both formulas do the job but Byundt's formula is shorter.

Good teamwork.....and thank you.  BTW; Byundt was correct on my mock up...... I had the wrong column identified!  Good catch.... you gave me a great answer anyway.

B.