+ Reply to Thread
Results 1 to 8 of 8

increment all cell references in an array formula by 24 when copied down a row

  1. #1
    Registered User
    Join Date
    04-26-2013
    Location
    lincs, england
    MS-Off Ver
    Excel 2010
    Posts
    4

    increment all cell references in an array formula by 24 when copied down a row

    Hi
    I have a sheet with hourly re4ading and an array formula that conditionally averages the readings to give a daily average.
    I'm trying to copy this array formula dow by 24 for each cell refernce in the array so i can get the daily average for the next 24 hrs
    =AVERAGE((IF($B16:$B39>$M$4,IF($I16:$I39<1,$F16:$F39))),0)
    would become
    =AVERAGE((IF($B40:$B63>$M$4,IF($I40:$I63<1,$F40:$F63))),0)

    I've tried using offset but can't seem to get it right
    .
    I've got to get the daily avarages for 5 years worth of hourly averages so don't want to change each array by hand.
    any help greatly appreciated

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

    Re: increment all cell references in an array formula by 24 when copied down a row

    Hi ariapro22,

    welcome to the forum.

    Try using below formula which I thought without seeing your excel workbook, upload the workbook if you find any issue -

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  3. #3
    Registered User
    Join Date
    04-26-2013
    Location
    lincs, england
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: increment all cell references in an array formula by 24 when copied down a row

    Hi and thanks for the reply. I tried this but got a value error. I'll have another go at this but I've achieved the end result by using a macro to copy the array into a new cell, copy that onto itself 24 times then copy the result back to the next cell down. I put this into a loop
    Set h1 = Range("k43872")
    Set h2 = Range("k43873")
    Dim counter As Integer
    Dim counter2 As Integer

    For counter2 = 1 To 1828

    Set R = ActiveCell
    h1.FormulaArray = R.FormulaArray
    For counter = 1 To 24
    h1.Copy h2
    h1.FormulaArray = h2.FormulaArray

    Next counter

    R = Selection.Offset(1, 0).Select
    ActiveCell.FormulaArray = h2.FormulaArray
    Next counter2

    End Sub


    crude but it works

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

    Re: increment all cell references in an array formula by 24 when copied down a row

    Thats' good ariapro

    Two suggestion:- 1) please wrap the code in code wrap like
    Please Login or Register  to view this content.
    and 2) please mark this thread as [SOLVED].. thanks.

    Regards,
    DILIPandey
    <click on below * if this helps>

  5. #5
    Registered User
    Join Date
    04-26-2013
    Location
    lincs, england
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: increment all cell references in an array formula by 24 when copied down a row

    sorry, I didn't know how. I clicked on the first reply as solved. hope this is ok.
    thanks for the help.

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

    Re: increment all cell references in an array formula by 24 when copied down a row

    Below is what I found in forum rules:-
    If your problem is solved, please say so clearly, and mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved". Or click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Dropdown option or Edit button will not appear -- ask a moderator to mark it.
    Regards,
    DILIPandey
    <click on below * if this helps>

  7. #7
    Registered User
    Join Date
    04-26-2013
    Location
    lincs, england
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: increment all cell references in an array formula by 24 when copied down a row

    got it and have done so, apologies for rushing in where lesser fools fear to thread

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

    Re: increment all cell references in an array formula by 24 when copied down a row

    Thanks ariapro22



    Regards,
    DILIPandey
    <click on below * if this helps>

+ 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