+ Reply to Thread
Results 1 to 12 of 12

Average offset help.

  1. #1
    Registered User
    Join Date
    04-26-2012
    Location
    Washington, PA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Average offset help.

    So I have a spread sheet that look like this

    A B C D E....W
    Country A 1980
    Country A 1981
    .
    .
    .
    Country A 2004
    Country B
    .
    .
    .

    With different variables in each column. I want to take a 5 year average i.e. country A between 1980-1984 and country A 1985-1989...etc.)

    I tried using offset but I couldn't program it correctly. I don't mind doing each individual column...autofill wasn't doing what I wanted.

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Average offset help.

    Hi Gaikee,

    welcome to the forum.

    Do you have all the Country As data consecutively... ? would suggest you to upload a sample file. thanks

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  3. #3
    Forum Contributor tkowal's Avatar
    Join Date
    11-20-2010
    Location
    Miami, Fl
    MS-Off Ver
    Excel 2010
    Posts
    150

    Re: Average offset help.

    http://www.youtube.com/watch?v=RF_-fBODJWw

    This should assist you..... you would be doing a sumif/countif
    Ted
    "Live Long and Prosper"

  4. #4
    Registered User
    Join Date
    04-26-2012
    Location
    Washington, PA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Average offset help.

    Sorry I don't know how to upload a sample. Here it is on google docs. https://docs.google.com/open?id=1fAL...tvFCVkw943E-5O

  5. #5
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Average offset help.

    Hi gaikee,


    To attach a file, click on "Go Advanced" while replying and look for paper clip icon to upload a file. thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  6. #6
    Registered User
    Join Date
    04-26-2012
    Location
    Washington, PA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Average offset help.

    sample.xlsx

    Sorry for my ignorance and I hope this is enough of a sample.

  7. #7
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Average offset help.

    Take a look at this. Column Y. I set it so that it doesn't necessarily have to be a 5 year average. The formula in Y7 is an array formula (use CNTRL SHFT ENTER instead of just enter)
    Please Login or Register  to view this content.
    where "Dataset" is a defined named range. Is this what you wanted?
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  8. #8
    Registered User
    Join Date
    04-26-2012
    Location
    Washington, PA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Average offset help.

    I don't know if my last post showed, but I talked to my friend who said I'm looking for a dynamic macro where both Average[A(x):B(y)]. I want to be able to see the averages all at once to be able to run a linear regression.

  9. #9
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Average offset help.

    Could you use AVERAGEIFS() function? Like so:

    =AVERAGEIFS(Sheet1!E:E,Sheet1!A:A,"Afghanistan",Sheet1!B:B,">="&1980,Sheet1!B:B,"<="&1984) gives result of 954.146 for GDP

    replace the country name and start/end years with cell references that hold the values

  10. #10
    Registered User
    Join Date
    04-26-2012
    Location
    Washington, PA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Average offset help.

    that's really close to what I'm looking for, but is there a way to have the years increase every five years from 1980 to 2004? I'm working with 150 countries so any amount I can cut off can be helpful.

  11. #11
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Average offset help.

    I'm not sure what you mean but have a look at the attached file.

    There is a drop list for country name and another for start year. The end year changes according to the start year.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    04-26-2012
    Location
    Washington, PA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Average offset help.

    Here is the end product I am looking for. Sorry, I haven't been communicating well and I have no experience with macros of any nature. I was fooling around and I entered =Average($B:$b) and I got 1992. I think I took the average of the whole column at once. Is there anyway to have it more dynamic so it takes an average of one statitic (so like B2:B6) and then it moves to (b7:b11)?
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1