Average of Two Columns Meeting a Specific Criterion

JeffFinnan

Board Regular
Joined
Aug 12, 2020
Messages
60
Office Version
  1. 2019
Platform
  1. Windows
Below is a partial list of data. I have two separate nest types. I want to get the average the temperatures of the combined set for each number of days. For example the average temperature of the temperatures at 51 days, at 52 days, etc. That is easy for me set up for one set but not for the two sets.
NestLaidEmergedTempInc DaysNestLaidEmergedTempInc Days
GS001
5/3​
7/4​
80.1​
62​
GN001
5/4​
7/4​
80.1​
61​
GS002
5/8​
7/5​
80.5​
58​
GN002
5/8​
7/3​
80.3​
56​
GS003
5/9​
7/6​
80.5​
58​
GN003
5/8​
7/5​
80.5​
58​
GS004
5/13​
7/11​
80.9​
59​
GN004
5/10​
7/4​
80.4​
55​
GS005
5/13​
7/11​
80.9​
59​
GN005
5/14​
7/5​
80.9​
52​
GS006
5/15​
7/5​
80.9​
51​
GN006
5/15​
7/12​
81.1​
58​
GS007
5/17​
7/14​
81.3​
58​
GN007
5/15​
7/10​
81.1​
56​
GS008
5/18​
7/17​
81.4​
60​
GN008
5/17​
7/12​
81.2​
56​
GS009
5/19​
7/15​
81.5​
57​
GN009
5/18​
7/14​
81.4​
57​
GS010
5/20​
7/13​
81.4​
54​
GN010
5/19​
7/14​
81.5​
56​
GS011
5/20​
7/10​
81.4​
51​
GN011
5/20​
7/14​
81.5​
55​
GS012
5/21​
7/14​
81.7​
54​
GN012
5/20​
7/16​
81.5​
57​
GS013
5/21​
7/13​
81.6​
53​
GN013
5/24​
7/16​
81.9​
53​
GS014
5/22​
7/13​
81.7​
52​
GN014
5/25​
7/14​
82.0​
50​
GS015
5/22​
7/14​
81.8​
53​
GN015
5/25​
7/15​
82.0​
51​
GS016
5/23​
7/15​
81.9​
53​
GN016
5/25​
7/15​
82.0​
51​
GS017
5/23​
7/17​
81.8​
55​
GN017
5/25​
7/13​
81.9​
49​
GS018
5/23​
7/14​
81.8​
52​
GN018
5/26​
7/13​
81.9​
48​
GS019
5/24​
7/14​
81.9​
51​
nvGN019
5/26​
#N/A​
#N/A​
#N/A​
GS020
5/24​
7/14​
81.9​
51​
GN020
5/27​
7/19​
82.0​
53​
GS021
5/25​
#N/A​
#N/A​
#N/A​
GN021
5/27​
7/15​
82.0​
49​
GS022
5/26​
7/19​
81.9​
54​
GN022
5/28​
7/21​
81.9​
54​
GS023
5/29​
7/18​
82.0​
50​
GN023
5/29​
7/18​
82.0​
50​
GS024
5/30​
7/20​
82.0​
51​
GN024
5/29​
7/25​
81.9​
57​
GS025
5/30​
7/15​
82.1​
46​
GN025
5/30​
7/19​
82.0​
50​
GS026
5/30​
7/18​
82.0​
49​
GN026
5/30​
7/20​
82.0​
51​
GS027
5/31​
7/24​
82.0​
54​
GN027
5/30​
7/25​
81.9​
56​
GS028
5/31​
7/21​
82.0​
51​
GN028
6/1​
7/19​
82.1​
48​
GS029
6/1​
#N/A​
#N/A​
#N/A​
GN029
6/1​
7/23​
82.0​
52​
GS030
6/1​
7/21​
82.1​
50​
GN030
6/1​
7/24​
82.1​
53​
GS031
6/1​
7/21​
82.1​
50​
GN031
6/2​
7/21​
82.1​
49​
GS032
6/2​
#N/A​
#N/A​
#N/A​
GN032
6/3​
7/25​
82.2​
52​
GS033
6/5​
7/24​
82.3​
49​
GN033
6/4​
7/24​
82.3​
50​
GS034
6/5​
7/27​
82.3​
52​
GN034
6/4​
7/23​
82.2​
49​
GS035
6/6​
7/26​
82.4​
50​
GN035
6/4​
7/25​
82.3​
51​
GS036
6/6​
7/29​
82.3​
53​
GN036
6/4​
7/24​
82.3​
50​
GS037
6/7​
7/30​
82.3​
53​
GN037
6/4​
7/25​
82.3​
51​
GS038
6/8​
7/31​
82.2​
53​
GN038
6/5​
7/26​
82.3​
51​
GS039
6/9​
7/31​
82.2​
52​
GN039
6/6​
7/25​
82.4​
49​
GS040
6/9​
7/29​
82.3​
50​
GN040
6/6​
7/26​
82.4​
50​
GS041
6/9​
7/27​
82.3​
48​
GN041
6/6​
7/25​
82.4​
49​
GS042
6/10​
7/31​
82.2​
51​
GN042
6/7​
8/2​
82.3​
56​
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
If you have O365 you can use the GroupBy function

=GROUPBY(Table1[Inc Days],Table1[Temp],AVERAGE)

otherwise, you can groupby in power Query and apply the Average function within that functionality.

If you need to see this applied, then repost your data using XL2BB. Your current presentation does not allow for this as it presents as Text when copied and pasted. I will not spend any time rebuilding your spreadsheet manually when you can provide the information in a usable format.
 
Upvote 0
Columns D and K are temp. Columns E and L are Inc Days.
R2= 51
ARRAY Formula in S2
Excel Formula:
=IFERROR((SUM(IFERROR(($E$3:$E$300=$R2)*($D$3:$D$300),0))+SUM(IFERROR(($L$3:$L$300=$R2)*($K$3:$K$300),0)))/(SUM(1*IFERROR($E$3:$E$300=$R2,0))+SUM(1*IFERROR($L$3:$L$300=$R2,0))),"")
To enter ARRAY formula
Copy and paste the formula in cell
Press F2
Press Ctrl+Shift+Enter together
Excel covers the formula with {}.
 
Upvote 0
How about:
Excel Formula:
=(SUMIFS(D2:D43,E2:E43,M2)+SUMIFS(J2:J43,K2:K43,M2))/(COUNTIFS(E2:E43,M2)+COUNTIFS(K2:K43,M2))
where M2 contains the day you’re seeking the average of (e.g. 51).
 
Upvote 0
f you have O365 you can use the GroupBy function

=GROUPBY(Table1[Inc Days],Table1[Temp],AVERAGE)

otherwise, you can groupby in power Query and apply the Average function within that functionality.

If you need to see this applied, then repost your data using XL2BB. Your current presentation does not allow for this as it presents as Text when copied and pasted. I will not spend any time rebuilding your spreadsheet manually when you can provide the information in a usable format.
While I was able to use the solution suggested by kvsrinivasamurthy, I would like to learn how to use power Query. Here is my data again.
dailyTemperatures_2024.xlsm
BABBBCBDBEBFBGBHBIBJBKBL
2NestLaidEmergedAve TempInc DaysNestLaidEmergedAve TempInc Days
3GS0015/37/480.162GN0015/47/480.161
4GS0025/87/580.558GN0025/87/380.356
5GS0035/97/680.558GN0035/87/580.558
6GS0045/137/1180.959GN0045/107/480.455
7GS0055/137/1180.959GN0055/147/580.952
8GS0065/157/580.951GN0065/157/1281.158
9GS0075/177/1481.358GN0075/157/1081.156
10GS0085/187/1781.460GN0085/177/1281.256
11GS0095/197/1581.557GN0095/187/1481.457
12GS0105/207/1381.454GN0105/197/1481.556
13GS0115/207/1081.451GN0115/207/1481.555
14GS0125/217/1481.754GN0125/207/1681.557
15GS0135/217/1381.653GN0135/247/1681.953
16GS0145/227/1381.752GN0145/257/1482.050
17GS0155/227/1481.853GN0155/257/1582.051
18GS0165/237/1581.953GN0165/257/1582.051
19GS0175/237/1781.855GN0175/257/1381.949
20GS0185/237/1481.852GN0185/267/1381.948
21GS0195/247/1481.951nvGN0195/26#N/A#N/A#N/A
22GS0205/247/1481.951GN0205/277/1982.053
23GS0215/25#N/A#N/A#N/AGN0215/277/1582.049
24GS0225/267/1981.954GN0225/287/2181.954
25GS0235/297/1882.050GN0235/297/1882.050
26GS0245/307/2082.051GN0245/297/2581.957
27GS0255/307/1582.146GN0255/307/1982.050
28GS0265/307/1882.049GN0265/307/2082.051
29GS0275/317/2482.054GN0275/307/2581.956
30GS0285/317/2182.051GN0286/17/1982.148
31GS0296/1#N/A#N/A#N/AGN0296/17/2382.052
32GS0306/17/2182.150GN0306/17/2482.153
33GS0316/17/2182.150GN0316/27/2182.149
34GS0326/2#N/A#N/A#N/AGN0326/37/2582.252
35GS0336/57/2482.349GN0336/47/2482.350
36GS0346/57/2782.352GN0346/47/2382.249
37GS0356/67/2682.450GN0356/47/2582.351
38GS0366/67/2982.353GN0366/47/2482.350
39GS0376/77/3082.353GN0376/47/2582.351
40GS0386/87/3182.253GN0386/57/2682.351
41GS0396/97/3182.252GN0396/67/2582.449
42GS0406/97/2982.350GN0406/67/2682.450
43GS0416/97/2782.348GN0416/67/2582.449
44GS0426/107/3182.251GN0426/78/282.356
45GS0436/117/2982.248GN0436/77/2682.449
46GS0446/127/3082.148GN0446/7#N/A#N/A#N/A
47GS0456/127/3182.149GN0456/77/2682.449
48GS0466/127/3182.149GN0466/87/2582.447
49GS0476/137/3182.148GN0476/87/2782.349
SA 2024
Cell Formulas
RangeFormula
BA3:BA49BA3='C:\Users\JeffF\Dropbox\gtm\Turtles\2024\[turtleNestCountGTM-2024.xlsm]GTM Data 2024'!$B6
BB3:BB49BB3='C:\Users\JeffF\Dropbox\gtm\Turtles\2024\[turtleNestCountGTM-2024.xlsm]GTM Data 2024'!$C6
BC3:BC49BC3='C:\Users\JeffF\Dropbox\gtm\Turtles\2024\[turtleNestCountGTM-2024.xlsm]GTM Data 2024'!$K6
BD3:BD49BD3=AVERAGE(INDEX(E$2:E$292,MATCH(BB3,B$2:B$292,)):INDEX(E$2:E$292,MATCH((BC3-1),B$2:B$292,)))
BE3:BE49,BL3:BL49BE3=BC3-BB3
BH3:BH49BH3='C:\Users\JeffF\Dropbox\gtm\Turtles\2024\[turtleNestCountGTM-2024.xlsm]GTM Data 2024'!$M6
BI3:BI49BI3='C:\Users\JeffF\Dropbox\gtm\Turtles\2024\[turtleNestCountGTM-2024.xlsm]GTM Data 2024'!$N6
BJ3:BJ49BJ3='C:\Users\JeffF\Dropbox\gtm\Turtles\2024\[turtleNestCountGTM-2024.xlsm]GTM Data 2024'!$V6
BK3:BK49BK3=AVERAGE(INDEX(E$2:E$292,MATCH(BI3,B$2:B$292,)):INDEX(E$2:E$292,MATCH((BJ3-1),B$2:B$292,)))
 
Upvote 0

Forum statistics

Threads
1,221,522
Messages
6,160,314
Members
451,637
Latest member
hvp2262

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