+ Reply to Thread
Results 1 to 4 of 4

How to SUM columns using a variable limit

  1. #1
    Registered User
    Join Date
    08-30-2014
    Location
    Lincoln, England
    MS-Off Ver
    Office 365
    Posts
    74

    How to SUM columns using a variable limit

    Could someone please suggest a neat way of using SUM with a variable column range.

    I want the result of the sum to appear in Sheet 1 Row 1 Column A. The amounts to be summed are in Sheet 1 Row 1 Columns B to x where x is defined by an integer or long (not a letter) in Sheet 2 Cell A1. Assume it's any number from 1 upwards.

    So, if the integer is 1 then the SUM will be B1:B1; if the integer is 2 then the SUM will be B1:C1; if 3 then B1:D1 and 4, B1:E1 and so on.

    I hope that makes sense! I just need a tidy way of expressing it.

    Thanks.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How to SUM columns using a variable limit

    =sum(b1:index(1:1, sheet2!a1 + 1))
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    08-30-2014
    Location
    Lincoln, England
    MS-Off Ver
    Office 365
    Posts
    74

    Re: How to SUM columns using a variable limit

    I wish you were my neighbour! Brilliant, as always. Thank you again!

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How to SUM columns using a variable limit

    You're welcome.

+ 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] Ways Bypass 255 Character String Variable Type Limit
    By rkl303 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-26-2015, 01:59 PM
  2. variable monthly usage with maximum limit.
    By excobra in forum Excel General
    Replies: 1
    Last Post: 05-29-2014, 06:41 AM
  3. Replies: 4
    Last Post: 03-27-2013, 10:05 PM
  4. Help declaring array limit with variable?
    By Ed in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-17-2005, 01:05 PM
  5. [SOLVED] Can I add more columns to a spread sheet or is limit 256 columns
    By Piper in forum Excel General
    Replies: 4
    Last Post: 10-09-2005, 04:05 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