average of non-contiguous range based on criteria

G

gtslabs

I have a summary page with data in rows. Within that row I want the
average of all the numbers that have a specific value in the cell
before it.
For instance:
3 3500 3 3500 7 4000 7 4000 28 5000 28
I want the average of all the numbers with 7 before it or 4000. I
have 10 sets of data to shearch from.

Do I need a vba program to do this?
 
P

Peo Sjoblom

Maybe something like this


=SUMPRODUCT(--(A1:K1=7),B1:L1)/COUNTIF(A1:L1,7)

will work for you example



--


Regards,


Peo Sjoblom
 
G

gtslabs

Worked Great! - Thank you,
Could you please expalin the use of the -- ?
I have never seen this before.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top