ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Links and Linking in Excel (https://www.excelbanter.com/links-linking-excel/)
-   -   Averaging Value between Two Serial Dates (https://www.excelbanter.com/links-linking-excel/55623-averaging-value-between-two-serial-dates.html)

ChrisM

Averaging Value between Two Serial Dates
 
Hi all,

I have two spreadsheets. The first spreadsheet contains two columns, one for
start date/time (in serial format) and the second for stop date/time (in
serial format).

The second spreadsheet contains two columns. One containing a serial
date/time and the other containing a meteorological value (eg. temperature).

I want Excel to read the start and stop date/time from the first spreadhseet
and then search the second spreadsheet for all temperature values which were
recorded during this time frame.

Lastly, I want Excel to average these values.

Is this possible using a single Excel function?? Or will I have to use many
nested functions?? Would it be easier to use VBA and if so where would I
start?? Any help would be greatly appreciated. Thanks

Chris



Bill Manville

Averaging Value between Two Serial Dates
 
Ah, so after I spent 30 minutes developing a formula for your previous
data structure you have decided to change the structure. This is much
easier to work with...

Assuming the column of meteo date/time is named MeteoDates and the
readings are named MeteoVal we can use SUMIF to get the sum of the
readings at times after the StartDateTime and subtract those which are
after the StopDateTime:
=(SUMIF(MeteoDates,StartDateTime,MeteoVal)-SUMIF(MeteoDates,StopDateT
ime,MeteoVal))/(COUNTIF(MeteoDates,StartDateTime)-COUNTIF(MeteoDates,
StopDateTime))

By the way, this question would be better suited to the
WorksheetFunctions newsgroup

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - respond to newsgroup



All times are GMT +1. The time now is 06:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com