+ Reply to Thread
Results 1 to 4 of 4

summing up alternate cells

  1. #1
    Registered User
    Join Date
    05-14-2008
    Posts
    56

    summing up alternate cells

    Solved, sorry for posting
    Last edited by michaelkwc; 05-24-2008 at 03:15 AM.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    michaelkwc,

    If you solve the problem you should post the answer. Also please read forum rules below and post to the correct forum next time. I have moved to functions

    Here's my suggestion

    This sums odd rows
    =SUMPRODUCT(MOD(ROW(B1:B99),2)*B1:B99)
    This sums even rows
    =SUMPRODUCT((1-MOD(ROW(B1:B99),2))*B1:B99)
    combine the two to get the difference

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    If your data is in B2:B201 then this should return what you want.

    =SUMPRODUCT( MOD(ROW(B2:B201)-ROW(B2),2)*B2:B201 - MOD(ROW(B3:B202)-ROW(B2),2)*B2:B201 )
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Registered User
    Join Date
    05-14-2008
    Posts
    56

    sorry, did not realise

    sorry, did not realise that this problem belonged in Functions... did not even realise there was such a subforum too because i wrongly assumed that Programming included everything. my bad.

    my problem was that i didn't realise my original demo data was inadequate; it was odd in number (e.g. 5 cells), and thus when i take EVEN-ODD, it returned an error since well a blank cell can't minus a cell with data. Added another line of data and it worked fine.

    still, thanks for the functions, it definitely helps much better than my

    Please Login or Register  to view this content.
    again, sorry, and thank you.

+ 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