+ Reply to Thread
Results 1 to 8 of 8

Code to analyse data in a row and return a average

  1. #1
    Registered User
    Join Date
    03-25-2010
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    44

    Code to analyse data in a row and return a average

    Good Morning. In the attached sheet you will see in Column D there are groups of 3 utilisation figures. There are also the occasional group of 2. I need a piece of code that analyses the blocks of data and returns a average in Column E. The current averages have been manually calculated using simple formula but I need some code as this spreadsheet covers many sites all needing to display similar information.

    Thanks in advance for your assistance.
    Attached Files Attached Files

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Code to analyse data in a row and return a average

    Hi Macca_GB,

    In
    D2
    =IF(C2<>"",(B2-C2)/B2,"")
    fill down

    In
    E2
    =IF(D3="",SUM(INDEX(D:D,MAX(IF($D$1:D2=0,ROW($D$1:D2)))+1):D2)/COUNT(INDEX(D:D,MAX(IF($D$1:D2=0,ROW($D$1:D2)))+1):D2),"")
    with Crtl + Shift + enter
    fill down
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    03-25-2010
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    44

    Re: Code to analyse data in a row and return a average

    Hi Pike, I couldnt get that to work. Could I ask you to insert the formulae in the worksheet so I can see exactly where it goes.

    Thanks

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Code to analyse data in a row and return a average

    Hi Macca_GB,
    You had the auto calculation turmed off
    Attached Files Attached Files

  5. #5
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Code to analyse data in a row and return a average

    Macca_GB
    Leave it with me I recheck to night

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Code to analyse data in a row and return a average

    Hey Macca_GB
    this works with a helper column

    =IF(AND(D5="",D4=""),SUMPRODUCT(VALUE(0&D$2:D201)*(F$2:F201=F3))/COUNTIF(F$2:F201,F3),"")

    If i can work it out without a helper column I post it
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    03-25-2010
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    44

    Re: Code to analyse data in a row and return a average

    What is a helper column?

  8. #8
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Code to analyse data in a row and return a average

    hi Macca_GB,
    Its a when you cant achieve a One cell formula and need and extra column formula to help with the calculation.

+ 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