average multiple columns but skip a few columns

C

cpliu

How can I average muliple columns that are not continuous? For
example, I'd like to average A2 to Z2 but ignore the numbers in C2, F2
to H2?

Thanks for the help
 
C

cpliu

I'm doing weighted avreage but I need it to skip any cells without an
average.

Total number average
------------------------
10 4.3
5
90 4.1
15 4.4
30

I'd like it to ignore the row with total number of 5 and 30 as they
don't have data for average. If I use =SUMPRODUCT(B1:B5,A1:A5)/SUM
(A1:A5) it will include 5 and 30 into the division. How can I ask it
to not sum up if B has no data?

Thanks for the help,
 
S

Shane Devenshire

Hi,

Here is the idea behind a conditional weighted average:

=SUMPRODUCT(--(C2:C9=K2:K9),A2:A9*B2:B9)/SUMPRODUCT(B2:B9*(C2:C9=K2:K9))

Change your ranges. Here C2 is being compared to K2 but you can adjust this
to test for blank cells B1:B5<>""
 
B

Bernie Deitrick

=SUMPRODUCT(B1:B5,A1:A5)/SUMPRODUCT((B1:B5<>"")*A1:A5)

HTH,
Bernie
MS Excel MVP
 

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

Similar Threads

Average Question 2
averaging numbers 5
Can I include functions in a CSV file? 5
Problems referencing dates with the MATCH formula 12
Average Value 34
=AVERAGE (see underlying values?) 7
Average 10
Avrage of averages 1

Top