+ Reply to Thread
Results 1 to 5 of 5

Creating a variable in excel

  1. #1
    Registered User
    Join Date
    10-25-2011
    Location
    Norrköping Sweden
    MS-Off Ver
    Excel 2003
    Posts
    13

    Creating a variable in excel

    Hello!
    Quite not sure how to formulate this but my problem is as following:

    Imagine I have the following in an excell sheet

    A B
    12 A2
    12 A6
    1
    1
    2 Sum(value(B1):value(B2))
    2
    1
    1
    1
    43


    I want to be able to in B5 sum any what is written in B1 and B2, so If I change B2 to "A10" it should sum from A2 to A10. So basically I need the values in B1 and B2 to be variables. Hope you understad my question, thankfull for any help.

    Regards Alexander
    Last edited by Alexander_V; 10-25-2011 at 04:38 AM.

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Creating a variable in excel

    Try =SUM(INDIRECT(B1 & ":" & B2))

  3. #3
    Registered User
    Join Date
    10-25-2011
    Location
    Norrköping Sweden
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Creating a variable in excel

    Great, thanks, now I have an additional question

    How would you easiest put in another worksheet into that, if the summary part and the references were in bok2 and the data in bok 1, of course I can write in bok2
    =INDIRECT("'bok1'!"&B1) but I would prefer if the name of the sheet were free aswell.

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Creating a variable in excel

    Assuming that the workbook name is in cell C1 then:

    =SUM(INDIRECT("'" & C1 & "'!" & B1 & ":" & B2))

  5. #5
    Registered User
    Join Date
    10-25-2011
    Location
    Norrköping Sweden
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Creating a variable in excel

    Thanks alot Andrew!

+ 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