+ Reply to Thread
Results 1 to 8 of 8

Square Wave Averages

  1. #1
    Registered User
    Join Date
    11-13-2014
    Location
    New Jersey
    MS-Off Ver
    2010
    Posts
    3

    Square Wave Averages

    I have a data set that when graphed, it produces a square wave that goes between ~-0.02 to -2.18 and repeats fairly consistently. I need to calculate the averages of the peaks and troughs. I have determined that I need to average one from A15:A67 and then the other from A72:A310 and then repeating again with A315:A367 and A372:A610. etc. Is there a way to make excel calculate these averages with just a drag down or something similar?

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Square Wave Averages

    Hi.

    Not the most succinct, but:

    =AVERAGE(INDEX(A:A,15+57*ISEVEN(ROWS($1:1))+300*(CEILING(ROWS($1:1)/2-1,1))):INDEX(A:A,67+243*ISEVEN(ROWS($1:1))+300*(CEILING(ROWS($1:1)/2-1,1))))

    in your first cell of choice and then copied down will give results equivalent to, successively:

    =AVERAGE(A15:A67)
    =AVERAGE(A72:A310)
    =AVERAGE(A315:A367)
    =AVERAGE(A372:A610)
    =AVERAGE(A615:A667)
    =AVERAGE(A672:A910)


    ...etc.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

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

    Re: Square Wave Averages

    So your first set is 238 points (A72:A310), then 52 points (A315:A367) then 238 (A372:A610) then 52 and so on, with 5 points between?
    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

  4. #4
    Registered User
    Join Date
    11-13-2014
    Location
    New Jersey
    MS-Off Ver
    2010
    Posts
    3

    Re: Square Wave Averages

    Thank you so much that worked when I dragged it down manually, but I have a lot of data ~200,000 points and excel timed out and crashed when I tried to repeat over the whole set. Is there a way or ratio of cells I need to drag it down to specifically?

  5. #5
    Registered User
    Join Date
    11-13-2014
    Location
    New Jersey
    MS-Off Ver
    2010
    Posts
    3

    Re: Square Wave Averages

    Quote Originally Posted by ChemistB View Post
    So your first set is 238 points (A72:A310), then 52 points (A315:A367) then 238 (A372:A610) then 52 and so on, with 5 points between?
    Yes, that is correct. It repeats at those intervals for approximately 200,000 points. (depends on which data set I'm using). Manually dragging takes forever.

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Square Wave Averages

    Quote Originally Posted by reehilch View Post
    Thank you so much that worked when I dragged it down manually, but I have a lot of data ~200,000 points and excel timed out and crashed when I tried to repeat over the whole set. Is there a way or ratio of cells I need to drag it down to specifically?
    To how many cells did you copy the formula?

    Are you not able to determine this value by performing a simple calculation based on your dataset, so that you know precisely to how many rows you will need to copy this formula?

    Regards

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

    Re: Square Wave Averages

    If you copy this formula down in the next column, it will give the last row in A used by the cell to the right. Then you can see when your final point, i.e. 201234 is taken into account and stop dragging. Does that help?

    =67+243*ISEVEN(ROWS($1:1))+300*(CEILING(ROWS($1:1)/2-1,1))

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Square Wave Averages

    I was thinking more along the lines of, based on the ranges you give, you will require 6 formulas for every 1,000 rows: hence (200,000/1,000)x6 = 1,200 formulas.

    Regards

+ 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] convert square meters to square feet
    By mroberts in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-07-2013, 12:51 PM
  2. Big Wave Hello!
    By Beanmuncher in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 03-29-2013, 11:10 PM
  3. Replies: 3
    Last Post: 08-19-2009, 08:53 AM
  4. how to center a square plot area in a square chart
    By xppuser in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 03-11-2006, 04:20 AM
  5. Replies: 1
    Last Post: 10-24-2005, 08:05 PM

Tags for this Thread

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