+ Reply to Thread
Results 1 to 3 of 3

Creating a Dynamic sum function to add a set number of columns

  1. #1
    Registered User
    Join Date
    11-12-2014
    Location
    Kent, England
    MS-Off Ver
    2010
    Posts
    5

    Creating a Dynamic sum function to add a set number of columns

    I have a list of columns and I want to add them together using a reference cell to determine the number of columns to the right of the first to add together.

    Capture.PNG

    I have managed to do this using a nested IF formula

    "=IF(Q6=1,E10,IF(Q6=2,SUM(E10:F10),IF(Q6=3,SUM(E10:G10),IF(Q6=4,SUM(E10:H10),IF(Q6=5,SUM(E10:I10),IF(Q6=6,SUM(E10:J10),IF(Q6=7,SUM(E10:K10),IF(Q6=8,SUM(E10:L10),IF(Q6=9,SUM(E10:M10))))))))))"

    But i wondered if there was a simpler more elegant way to perform this function rather than adding an IF function for each new column.

    Something like =SUM(first column: (first column+red cell number of columns across))

    Thanks in advance!

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Creating a Dynamic sum function to add a set number of columns

    with this

    Please Login or Register  to view this content.
    Kind regards
    Leo

  3. #3
    Registered User
    Join Date
    11-12-2014
    Location
    Kent, England
    MS-Off Ver
    2010
    Posts
    5

    Re: Creating a Dynamic sum function to add a set number of columns

    Thank you, that worked perfectly!

    knew there must have been an easier way!

+ 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] creating dynamic number of rows in a listbox
    By anandvh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-15-2013, 09:38 AM
  2. [SOLVED] VBA Code To Return The Number Of Columns Between Two Dynamic Ranges.
    By GEANZ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-04-2013, 01:44 AM
  3. Replies: 1
    Last Post: 09-20-2012, 08:17 PM
  4. Replies: 3
    Last Post: 02-13-2012, 04:27 PM
  5. Creating a chart from dynamic number of rows
    By dahanaviv in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 07-13-2011, 01:55 PM
  6. Creating Pivot tables using dynamic columns
    By Sakuntala in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-06-2009, 05:30 AM
  7. [SOLVED] Automatically creating the correct number of dated columns
    By Struggling of Essex in forum Excel General
    Replies: 3
    Last Post: 04-25-2005, 01:06 PM
  8. Replies: 2
    Last Post: 04-01-2005, 01: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