+ Reply to Thread
Results 1 to 8 of 8

How to sum the contents of a table row whilst allowing changes to table

  1. #1
    Registered User
    Join Date
    05-09-2022
    Location
    UK
    MS-Off Ver
    MS Office 2016
    Posts
    15

    How to sum the contents of a table row whilst allowing changes to table

    Hi,

    I am trying to sum the contents of a table row in order to check whether the table inputs add to 100%, or 1. This is fairly simple to do (see example, columns A & B), but referencing the table columns by name causes issue when additional columns are added and need to be included in the sum also. Additionally, when the table is cleared using an existing macro (the "Clear table" button), the formula will obviously fail.

    Is there a way to make the formula always reference the columns from the second one (the first one with a percentage in, after 'date') to the end of the table? No matter the number of columns, or what they are called? I don't mind this not being in a Macro like the other functions, but to allow the other macros to work and columns to be added/deleted would be very helpful.

    Any help is much appreciated!

    Cheers,

    AttemptAtAnalysis
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,572

    Re: How to sum the contents of a table row whilst allowing changes to table

    Here's a couple of options:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    05-09-2022
    Location
    UK
    MS-Off Ver
    MS Office 2016
    Posts
    15

    Re: How to sum the contents of a table row whilst allowing changes to table

    Hi,

    This doesn't seem to work, and returns a 0 when used? It references the full table which is good (though the date column need not be counted).

    It also references the column called "Channel Name" - which seems to cause it to break when the table is cleared using the macro button present. Is there a workaround for this?

    Thanks for the help!

    Best,

  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
    28,007

    Re: How to sum the contents of a table row whilst allowing changes to table

    Please try

    =SUM(Table2[@Online]:INDEX(Table2,ROW(Table2[@])-8,COLUMNS(Table2)))
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  5. #5
    Registered User
    Join Date
    05-09-2022
    Location
    UK
    MS-Off Ver
    MS Office 2016
    Posts
    15

    Re: How to sum the contents of a table row whilst allowing changes to table

    I've just given this a try - it returns '22' instead of '1' on the first line of the table and I'm not sure why. It also still references a header name that can be changed or removed, which would cause issues when the table is cleared. The only column that is immune to this is the first 'date' column. Is there a way to only reference this first column, but sum the contents of each of the other columns for each row? In the example I attached all of these should return '1'

    Cheers,

  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
    28,007

    Re: How to sum the contents of a table row whilst allowing changes to table

    Try

    =SUM(INDEX(Table2,ROW(Table2[@])-8,2):INDEX(Table2,ROW(Table2[@])-8,COLUMNS(Table2)))
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    05-09-2022
    Location
    UK
    MS-Off Ver
    MS Office 2016
    Posts
    15

    Re: How to sum the contents of a table row whilst allowing changes to table

    Fantastic thank you! I have added to your rep

  8. #8
    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
    79,421

    Re: How to sum the contents of a table row whilst allowing changes to table

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    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.

+ 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] Extend currnt table whilst keeping the Formula (Create a live league table)
    By pmw19800 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-14-2018, 02:11 PM
  2. Timestamp column protection - whilst allowing for form to enter new records in rows
    By excelconditional in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-27-2017, 09:42 AM
  3. Table Not Allowing Sum
    By jo15765 in forum Excel General
    Replies: 1
    Last Post: 03-20-2015, 05:13 PM
  4. Replies: 1
    Last Post: 08-04-2014, 09:51 AM
  5. Protecting cells whilst allowing hyperlinks to be used
    By Ben.SFM in forum Excel General
    Replies: 0
    Last Post: 12-01-2011, 12:09 PM
  6. Replies: 1
    Last Post: 10-10-2011, 12:47 PM
  7. Replies: 2
    Last Post: 08-22-2006, 10:05 AM

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