Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
flummoxed
 
Posts: n/a
Default Calculating an AVG from data on another sheet

Let's say I have 2 columns of data on worksheet "Data" - column A is date,
and column B contains numeric values. Using a date found on worksheet "Test"
(in the same workbook), I'd like to lookup that date on "Data" and calculate
the average of the last 100 days of the values in column B.

It's easy enough to get the last of the 100 days using a simple VLOOKUP, but
I thought I might return the row of that cell found in the VLOOKUP and use
that value to construct an AVERAGE. Something like

AVERAGE(R[x-100]C[2]:R[x]C[2])

where x is the row that was found with the VLOOKUP. Does anyone know how to
return the row that results from a VLOOKUP? Or better yet, is there an
easier way to accomplish this task?

Thanks in advance!
Tom
  #3   Report Post  
Jason Morin
 
Posts: n/a
Default

Try:

=AVERAGE(OFFSET(B1,MATCH(Test!A1,A:A,0)-1,,-100))

where Test!A1 holds the lookup date value. This averages
the last 100 days inclusive based on the date in Test!A1.

HTH
Jason
Atlanta, GA

-----Original Message-----
Let's say I have 2 columns of data on worksheet "Data" -

column A is date,
and column B contains numeric values. Using a date

found on worksheet "Test"
(in the same workbook), I'd like to lookup that date

on "Data" and calculate
the average of the last 100 days of the values in column

B.

It's easy enough to get the last of the 100 days using a

simple VLOOKUP, but
I thought I might return the row of that cell found in

the VLOOKUP and use
that value to construct an AVERAGE. Something like

AVERAGE(R[x-100]C[2]:R[x]C[2])

where x is the row that was found with the VLOOKUP.

Does anyone know how to
return the row that results from a VLOOKUP? Or better

yet, is there an
easier way to accomplish this task?

Thanks in advance!
Tom
.

  #4   Report Post  
flummoxed
 
Posts: n/a
Default

Jason,

You da man! Your suggestion worked perfectly. Thanks much!

Tom

"Jason Morin" wrote:

Try:

=AVERAGE(OFFSET(B1,MATCH(Test!A1,A:A,0)-1,,-100))

where Test!A1 holds the lookup date value. This averages
the last 100 days inclusive based on the date in Test!A1.

HTH
Jason
Atlanta, GA

-----Original Message-----
Let's say I have 2 columns of data on worksheet "Data" -

column A is date,
and column B contains numeric values. Using a date

found on worksheet "Test"
(in the same workbook), I'd like to lookup that date

on "Data" and calculate
the average of the last 100 days of the values in column

B.

It's easy enough to get the last of the 100 days using a

simple VLOOKUP, but
I thought I might return the row of that cell found in

the VLOOKUP and use
that value to construct an AVERAGE. Something like

AVERAGE(R[x-100]C[2]:R[x]C[2])

where x is the row that was found with the VLOOKUP.

Does anyone know how to
return the row that results from a VLOOKUP? Or better

yet, is there an
easier way to accomplish this task?

Thanks in advance!
Tom
.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Transfer data from sheet to sheet Jenn Excel Discussion (Misc queries) 4 January 20th 05 03:07 PM
Pulling data from 1 sheet to another Dave1155 Excel Worksheet Functions 1 January 12th 05 05:55 PM
Automatic cell increment with data from sheet 1 to sheet 2 Big G Excel Worksheet Functions 2 December 20th 04 05:59 PM
pull data from sheet two, then fill in the data to sheet one (part Jim Excel Worksheet Functions 3 December 11th 04 04:51 AM
Function to automatically insert a new sheet as a result of data entry? Mark Mulik Excel Worksheet Functions 2 November 28th 04 02:21 AM


All times are GMT +1. The time now is 12:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"