+ Reply to Thread
Results 1 to 12 of 12

Skipping Complimentary Cells

  1. #1
    Registered User
    Join Date
    10-16-2017
    Location
    Charlotte
    MS-Off Ver
    2016
    Posts
    31

    Skipping Complimentary Cells

    Is there a way to make a sequence of cells, in which each cell is the sum of every cell in another sequence of cells except for a complementary cell in the other sequence without subtracting the complementary cell from the sum of all the cells in the sequence? For instance is it possible to have B1 be the sum of every cell in the sequence A1 through A1000 except for A1, B2 be the sum of every cell in the sequence A1 through A1000 except for B2, B3 be the sum of every cell in the sequence A1 through A1000 except for A3, and so on to B1000 being the sum of every cell in the sequence A1 through A1000 except for A1000, so that every cell in the series B1 though B1000 is the sum of every cell in the series A1 through A1000 except for the cell in the series that is in the same row as it is?

    I have attached an excel file with examples to help clarify what I am asking for. On both sheets column B and D contain the sums, although on sheet 1 the sums are simple sums while on sheet 2 the sums are in the form of an array function.
    Attached Files Attached Files
    Last edited by ancog; 10-19-2017 at 04:54 PM.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Skipping Complimentary Cells

    Hi, I haven't downloaded the file but based upon the your (difficult to read) explanation you might try something like this
    The is the SUMIFS() function to add a range using criteria from anothe range, or just SUM() for the entire range - the result of another sum
    something like

    Please Login or Register  to view this content.
    I think if you play around with the idea you might get what you want.
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Skipping Complimentary Cells

    Hi all- I agree w @Keebellah's approach - SUM the entire range, then subtract the same-row cell. Paste this in B2 and copy down:
    Please Login or Register  to view this content.
    ...and this in D2 and copy down:
    Please Login or Register  to view this content.
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,786

    Re: Skipping Complimentary Cells

    OT, and purely to do with semantics (and ambiguity), please read this: http://www.write.com/writing-guides/...us-compliment/
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Skipping Complimentary Cells

    I do not know why it should matter how the value is arrived at, but you requested a calculation "without subtracting the complimentary cell from the sum of all the cell"

    So try this in B2 copy down:
    =SUM($A$1:OFFSET($A1000,-1,0)) + (IF(ROW()=1000,0,SUM(,OFFSET($A1000,1,0):$A$1000)))
    (Above formula will require adapting if cell A1 contains anything other than text)
    May be more useful to make the formula more general and avoid IF(ROW() condition
    with:
    =SUM($A$1:OFFSET($A2,-1,0))+SUM(OFFSET($A2,1,0):$A$1048576)
    OR
    =SUM($A$1:OFFSET($A2,-1,0),OFFSET($A2,1,0):$A$1048576)
    Cell B1048576 will return an error - but I do not think you will be using that cell


    Best to ignore everything above
    It is easy to look stupid sometimes ....
    I forgot to simplify when I changed my approach ......
    Thank you @leelnich. (see post #6)

    in B2 copy down:
    =SUM($A$1:$A1,$A3:$A$1048576)







    EDIT
    formula amended
    Last edited by kev_; 10-19-2017 at 12:34 PM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  6. #6
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Skipping Complimentary Cells

    Hi all- Is it me, or was post#1 changed without a Last edited by... stamp? I don't remember the prohibition against subtraction of same-row cell. Oh well, here's a different implementation. Paste this in B2 and copy down:
    Please Login or Register  to view this content.
    @kev_, why use OFFSET()? Doesn't relative addressing do the same thing?
    Last edited by leelnich; 10-19-2017 at 03:33 PM.

  7. #7
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Skipping Complimentary Cells

    why use OFFSET()? Doesn't relative addressing do the same thing?
    This was a legacy of a change of approach
    - my original formula needed to refer to cell above
    - Excel refuses to accept =A0 (row zero)
    - But Excel does accept OFFSET(A1,-1,0) and the formula can be copied down
    - wrap IFERROR around it solves problem with first row
    etc....

    I will amend post#5 again

  8. #8
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Skipping Complimentary Cells

    Quote Originally Posted by kev_ View Post
    - Excel refuses to accept =A0 (row zero)
    - But Excel does accept OFFSET(A1,-1,0) and the formula can be copied down
    - wrap IFERROR around it solves problem with first row
    Interesting! You could also paste this in B2, and copy UP:
    Please Login or Register  to view this content.
    ...or just use a different formula for row 1.
    BTW, thanks for the rep!
    Last edited by leelnich; 10-19-2017 at 03:53 PM.

  9. #9
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Skipping Complimentary Cells

    @leelnich
    Copying up - why didn't I think of that

  10. #10
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Skipping Complimentary Cells

    Probably because you're a busy guy w better things to do!
    @ancog- does this solve your problem?

  11. #11
    Registered User
    Join Date
    10-16-2017
    Location
    Charlotte
    MS-Off Ver
    2016
    Posts
    31

    Re: Skipping Complimentary Cells

    I tested the suggestion from kev of using the formula =SUM($A$1:$A1,$A3:$A$1048576) and found that it works exactly as I was hoping it would work. I found that I could modify it for a sum of functions of cells and will work even when the complementary cell would otherwise cause the function to be undefined or when the complementary cell would produce a division by 0.

    Thank You!

  12. #12
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Skipping Complimentary Cells

    You are welcome - thanks for the rep

+ 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: 04-30-2017, 02:28 PM
  2. Replies: 16
    Last Post: 08-01-2015, 07:45 AM
  3. [SOLVED] Macro to combine cells in a row to 1 cell while skipping blank cells
    By ywang in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-18-2014, 10:39 AM
  4. [SOLVED] Macro to combine cells in a row to 1 cell while skipping blank cells
    By ywang in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-02-2014, 07:41 PM
  5. Replies: 1
    Last Post: 05-21-2014, 04:30 PM
  6. Collecting data from filled cells and skipping blank cells
    By KellieB in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-20-2012, 09:45 PM
  7. Replies: 2
    Last Post: 03-01-2007, 04:51 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