How to average values in mulitple columns based on criteria.

daveus

Board Regular
Joined
May 18, 2004
Messages
191
Hey my excel guru friends.

I need some help. I have something very similar to a recent post, but i want to take it a little farther. I many rows of data with different column values like this:

Link Lane Section Link ID v(0) Volume(0)
4 1 1 411 10.37 1183.67
4 2 1 421 7.94 1181.66
4 3 1 431 25.14 2315.05
4 4 1 441 22.80 2065.21
4 5 1 451 18.37 2079.25
4 6 1 461 24.59 1610.99
4 7 1 471 62.84 964.98
5 1 1 511 50.67 2033.01
5 1 2 512 63.10 2128.86
5 1 3 513 63.32 2157.63
5 1 4 514 63.15 2189.18
5 1 5 515 62.89 2188.61
5 1 6 516 62.57 2160.65
5 1 7 517 62.52 2122.58
5 1 8 518 62.24 2093.38
5 1 9 519 62.37 2059.59
5 1 10 5110 62.44 2035.54
5 2 1 521 54.06 2460.58
5 2 2 522 62.75 2370.67
5 2 3 523 63.02 2324.87
5 2 4 524 63.08 2276.89
5 2 5 525 63.02 2254.17
5 2 6 526 63.25 2244.25
5 2 7 527 63.31 2248.69
5 2 8 528 63.21 2233.35
5 2 9 529 63.11 2228.04
5 2 10 5210 63.17 2222.06
5 3 1 531 48.87 2066.98
5 3 2 532 60.18 1912.76
5 3 3 533 61.94 1893.75
5 3 4 534 62.98 1891.55
5 3 5 535 63.36 1919.38
5 3 6 536 63.62 1947.09
5 3 7 537 63.73 1966.34
5 3 8 538 63.39 1988.87
5 3 9 539 63.42 2008.87
5 3 10 5310 63.66 2021.01

So, in column 4 there is an id created from the concatenation of columns 1, 2, and 3.

I want to be able to average values for a range of sections (column 3). for example, i want the average of column 5 values that meet the following criteria:

link 5 (column 1), all lanes (column 2), and sections 3-7 (column 3).

This may be better done with VBA, so a solution either way would be appreciated. It can also take several cells if needed. Please tell me if this doesn't make sense. Thanks in advance for your time!

Dave...
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Re: How to average values in mulitple columns based on crite

Hi,

This is a little general formula:

=AVERAGE(IF(ISNUMBER(MATCH(A2:A38,H3:H9,0))*ISNUMBER(MATCH(B2:B38,I3:I9,0))*ISNUMBER(MATCH(C2:C38,J3:J9,0)),E2:E38))


You change the criterias you wnat to include in the tables above the formula.

The formula needs to be confirmed with Ctrl + Shift + Enter.
Book1
ABCDEFGHIJ
1LinkLaneSectionLinkv(0)Volume(0)
241141110.371183.67LinkLanesection
34214217.941181.66513
443143125.142315.0524
544144122.82065.2135
645145118.372079.2546
746146124.591610.9957
847147162.84964.986
951151150.672033.017
1051251263.12128.86
1151351363.322157.63
1251451463.152189.18
1351551562.892188.6163.051
1451651662.572160.65
Sheet5
 
Upvote 0
thanks! can anyone add to this so that i only have to enter a high and low for the section because some of them have sections from 2-100 and i'd rather enter just the max min instead of each section number (98 in this example).

any other thoughts? Thanks all! You guys continually amaze me!

Dave...
 
Upvote 0
Re: How to average values in mulitple columns based on crite

Like this?

=AVERAGE(IF((A2:A38>=H3)*(A2:A38<=H4)*(B2:B38>=I3)*(B2:B38<=I4)*(C2:C38>=J3)*(C2:C38<=J4),E2:E38))

confirmed with Ctrl + shift + enter.
Book1
ABCDEFGHIJ
1LinkLaneSectionLinkv(0)Volume(0)
241141110.371183.67LinkLanesection
34214217.941181.66MIN513
443143125.142315.05MAX575
544144122.82065.21
645145118.372079.25
746146124.591610.99
847147162.84964.98
951151150.672033.01
1051251263.12128.86
1151351363.322157.63
1251451463.152189.18
1351551562.892188.6162.973
1451651662.572160.65
1551751762.522122.58
1651851862.242093.38
1751951962.372059.59
185110511062.442035.54
Sheet5
 
Upvote 0

Forum statistics

Threads
1,214,565
Messages
6,120,254
Members
448,952
Latest member
kjurney

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top