+ Reply to Thread
Results 1 to 5 of 5

macro setting avg. to date.

  1. #1
    Registered User
    Join Date
    07-03-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    89

    macro setting avg. to date.

    What i need is a line of code that does the following.
    the data im taking the avg of is in J2:J(x), where x will increase. ill put the avg value in the AA2:AA(x) value in the same row.
    so in AA2, the value will be the same as J2
    in AA3 the value will be (J2+J3)/2
    in AA(x) the value is (J2+...+J(x))/(x-1)
    say this is the J row:
    HTML Code: 
    Thent his will be the vlaues in AA:
    HTML Code: 
    I want this to be part of a code. Currently i have a code that gathers data, and puts it into a row: so it will fill in all the other values, and when it has filled it all out, i want it to do this. fill in the latest row in the column AA. and the value of the latest AA cell should be the average of all the values in J:J so far. I got suggested earlier that
    HTML Code: 
    could work, but it is givng me all sorts of errors, and i cant figure out why/what is failing.

    any help is appreciated

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: macro setting avg. to date.

    Try:
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    07-03-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    89

    Re: macro setting avg. to date.

    I tried it, but it causes my worbook to crash/not responding. Uploading sample without any confidential data.
    Attached Files Attached Files

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,419

    Re: macro setting avg. to date.

    Data is not the activesheet when that line executes.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Registered User
    Join Date
    07-03-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    89

    Re: macro setting avg. to date.

    That works! thank you both so much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Setting Text to date.
    By arnevos in forum Excel General
    Replies: 4
    Last Post: 09-16-2013, 03:48 AM
  2. Replies: 0
    Last Post: 04-26-2011, 02:12 PM
  3. Setting Expiry Date
    By Lewis Koh in forum Excel General
    Replies: 4
    Last Post: 02-10-2010, 02:59 AM
  4. Problem setting range in macro based on todays date.
    By shakeyjake200 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-15-2009, 12:48 AM
  5. Date Language setting
    By Office user in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM

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