Which Function

rssl2000

New Member
Joined
Oct 18, 2017
Messages
26
Hello,
I'm trying to figure out which function or combination of functions to use. I'm trying to take the average from one column of data, but the data is chosen from another column of data, but in the same row. In the example below, column A is the criteria, but I want the number averaged to come from row B. So if I choose "1", the average is (15+19)=17.

A B
1 15
2 13
3 10
1 19
2 22
3 17

Thanks, Adam
 
What exactly do you entries in column B look like? Its a row of numbers generated by this formula, =C7-DATE(YEAR(C7),1,0)By "u22", do you mean the literal text "u22", or what is in cell u22? It means cell u22. Sorry, for some reason my formala didn't include the <, > or =, see below. When I enter >U23 into the Function Argument is adds the " ".

=AVERAGEIFS(F2:F8761,B2:B8761,"<T23",B2:B8761,">U23",B2:B8761,"<=1")
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
If you want > U23, then you need to write it like this:
Code:
=AVERAGEIFS(F2:F8761,B2:B8761,[COLOR=#ff0000]">" & U23[/COLOR],B2:B8761,"<=1")
 
Upvote 0
One other question. The range of data I'm looking at is 1-365, each number represented a day of the year. Typically the first number (Beg) is smaller then the last number (End), see example below. But when the numbers are reversed (last data in set), the function returns #DIV/0!. I think this is because the data set that I'm comparing those two numbers too is from 1 to 365. So when I say I want all number less then 15 or greater then 348, this causes the error. I tried to include >=1 as another criteria, hoping this could only look at numbers 1 and above, but no luck. Any ideas if that makes sense?

BegEnd
257285
226256
195225
165194
132164
103131
73102
4472
1643
34815

<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>
</tbody>
 
Upvote 0
OK, so how exactly does this Beg/End grid you just introduced now relate to your formula?
 
Upvote 0
My goal is to return an average outdoor air temp based on the two numbers. $F$2:$F$8761 is the outdoor air temperature for each hour of the year. I find all the days/hours between and including those two numbers to find the average. In the formula below, T=Beg, U=End. The numbers in the table represent dates, at first I couldn't figure out how to use dates, so I converted the dates to numbers, Jan 1=1, Jan 2=2, December 31=365, etc. $B$2:$B$8761 is hourly data for an entire year, 8,760 hours.

=AVERAGEIFS($F$2:$F$8761,$B$2:$B$8761,">=" & T12,$B$2:$B$8761,"<=" & U12)

BCDEF
MonthHourDATRounded
11-Jan042.0842
11-Jan133.0833
11-Jan237.0437
11-Jan335.0635
11-Jan428.9429
11-Jan530.0230
11-Jan630.0230
11-Jan732.0032
11-Jan832.0032
11-Jan939.0239
11-Jan1046.9447
11-Jan1151.0851
11-Jan1253.9654
11-Jan1357.0257
11-Jan1457.9258
11-Jan1557.0057
11-Jan1657.0057
11-Jan1757.0057
11-Jan1856.0056
11-Jan1956.0056
11-Jan2056.0056
11-Jan2156.0056
11-Jan2256.9357
11-Jan2355.9456
22-Jan055.0455
22-Jan155.9456
22-Jan255.0455
22-Jan353.9654
22-Jan453.9654
22-Jan553.9654
22-Jan655.0455
22-Jan757.0057
22-Jan857.0057
22-Jan957.0057
22-Jan1060.0060
22-Jan1160.0060

<colgroup><col><col span="2"><col><col></colgroup><tbody>
</tbody>

<colgroup><col><col span="2"><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
at first I couldn't figure out how to use dates, so I converted the dates to numbers
So that does mean you have everything figured out now, or is there still sort sort of issue/question?

By the way, you should be able to use dates. If Column C has valid dates, and cells T12 and U12 are valid dates, then this formula would work:
Code:
=AVERAGEIFS($F$2:$F$8761,$C$2:$C$8761,">=" & T12,$C$2:$C$8761,"<=" & U12)
Just note that even if you do not display the year in your Date format on the Excel screen, the year is still considered, as it is part of the date value.
 
Upvote 0
Thanks, but I'm still trying to work through the issue four posts above, see below.

One other question. The range of data I'm looking at is 1-365, each number represented a day of the year. Typically the first number (Beg) is smaller then the last number (End), see example below. But when the numbers are reversed (last data in set), the function returns #DIV/0!. I think this is because the data set that I'm comparing those two numbers too is from 1 to 365. So when I say I want all number less then 15 or greater then 348, this causes the error. I tried to include >=1 as another criteria, hoping this could only look at numbers 1 and above, but no luck. Any ideas if that makes sense?
 
Upvote 0
Let me ask an important question.
Are you trying to find the average temperature for a single time period, or for across ALL plan years?
For example, let's say you wanted the average temperature for January. Would you be looking the average of January for one particular year, or across ALL years?
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

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