+ Reply to Thread
Results 1 to 6 of 6

Sum of every alternate n and n+1 rows

  1. #1
    Registered User
    Join Date
    12-13-2021
    Location
    Kolkata, India
    MS-Off Ver
    Microsoft Office Home and Student 2019
    Posts
    28

    Sum of every alternate n and n+1 rows

    Hi,

    I have a data array A2:A20 and calculated the sum of every n rows by using the following formula.

    =SUM(OFFSET($A$1,(ROW()-1)*2,0,2,1))

    But, How can I get the sum of n+1 rows present in the same array by using a single formula? Is this possible?

    Best,
    Shivaji
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,743

    Re: Sum of every alternate n and n+1 rows

    With A1 blank

    in C2

    =SUM(OFFSET($A$1,INT((ROWS($1:1)-1)/2)*5+IF(ISODD(ROWS($1:1)),0,3),0,IF(ISODD(ROWS($1:1)),3,2),1))

    pattern is 3,2 etc with A1 blank.
    Attached Files Attached Files
    Last edited by JohnTopley; 02-03-2022 at 02:27 AM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Registered User
    Join Date
    12-13-2021
    Location
    Kolkata, India
    MS-Off Ver
    Microsoft Office Home and Student 2019
    Posts
    28

    Re: Sum of every alternate n and n+1 rows

    Hi,

    Thanks for your prompt response.

    I have attached another file where you can see a different situation. There is no particular pattern like the 3rows-2rows pattern.
    Does any VBA script work for this situation?
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,743

    Re: Sum of every alternate n and n+1 rows

    Yet again, wasting respondents time [providing a solution] and then changing the parameters.

    And no it will not work with VBA (except based on cell colour!) or formula because there is no way of determining the (random) pattern .

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Sum of every alternate n and n+1 rows

    There will be some parameter to decide the number of rows each time to sum. Unless you come up with complete details it is not possible to provide solution.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,743

    Re: Sum of every alternate n and n+1 rows

    Based on colouring alternating blocks as per your post:

    Please Login or Register  to view this content.
    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)

Similar Threads

  1. Replies: 1
    Last Post: 01-07-2019, 10:54 AM
  2. Need To Refer To Alternate Rows
    By unpluggedmusic in forum Excel General
    Replies: 4
    Last Post: 10-14-2012, 11:44 AM
  3. how do you add up alternate rows in the same column?
    By adrian078 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-29-2007, 12:25 AM
  4. [SOLVED] Printing Alternate Rows
    By LPS in forum Excel General
    Replies: 2
    Last Post: 07-17-2006, 01:50 PM
  5. Selecting alternate rows
    By Norm75 in forum Excel General
    Replies: 3
    Last Post: 10-14-2005, 09:05 AM
  6. [SOLVED] Add alternate rows
    By Teri in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-16-2005, 07:06 PM

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