+ Reply to Thread
Results 1 to 5 of 5

Variable filename

  1. #1
    Registered User
    Join Date
    07-29-2010
    Location
    Hove, England
    MS-Off Ver
    Excel 2003
    Posts
    3

    Variable filename

    Hi everyone
    This is my first venture into the forum.
    I have several excel files that I am trying to summarise on a seperate workbook. I can do all this fine, but not very efficiently. The following formula is an example of what I am trying to do:

    =IF(AND('[2010 - 06.xls]Expenditure'!$G$2=0,'Fixed costs'!$B4=""),"",
    IF('[2010 - 06.xls]Expenditure'!$G$2=0,'Fixed costs'!$B4,'[2010 - 06.xls]Expenditure'!$G$2))

    The formula works fine, however I am repeating the formula in the spreadsheet 533 times. I want to be able to change the filename automatically - '2010 - 06.xls' bit without having to change each formula individually. I will also want to change it all again in subsequent years.
    Has anybody got any great ideas, my VB skills are very limited. Thanks in anticipation.

    mgreenop

  2. #2
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Variable filename

    What do you want to change to what (specifically)?

    You can use find & replace on formulae...
    CC


    If you feel really indebted please consider a donation to charity. My preferred charity is ActionAid but there are plenty of worthy alternatives.

  3. #3
    Registered User
    Join Date
    07-29-2010
    Location
    Hove, England
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Variable filename

    Quote Originally Posted by mgreenop View Post
    Hi everyone
    This is my first venture into the forum.
    I have several excel files that I am trying to summarise on a seperate workbook. I can do all this fine, but not very efficiently. The following formula is an example of what I am trying to do:

    =IF(AND('[2010 - 06.xls]Expenditure'!$G$2=0,'Fixed costs'!$B4=""),"",
    IF('[2010 - 06.xls]Expenditure'!$G$2=0,'Fixed costs'!$B4,'[2010 - 06.xls]Expenditure'!$G$2))

    The formula works fine, however I am repeating the formula in the spreadsheet 533 times. I want to be able to change the filename automatically - '2010 - 06.xls' bit without having to change each formula individually. I will also want to change it all again in subsequent years.
    Has anybody got any great ideas, my VB skills are very limited. Thanks in anticipation.

    mgreenop
    Quote Originally Posted by Cheeky Charlie View Post
    What do you want to change to what (specifically)?

    You can use find & replace on formulae...
    Durrr... Yes sorry, I want to change the '2010 - 06.xls part of the filename to another date such as 2010 - 07.xls. This appears 3 times in the formula and I have multiple entries per month and obviously 12 months to modify. I hope this helps

  4. #4
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Variable filename

    No worries,

    Just open find&replace dialogue (ctrl+h), open the options and elect to look in formulas, simply find and replace exactly as you've described.

    The key thing is the drop down for look in formulae, not values


  5. #5
    Registered User
    Join Date
    07-29-2010
    Location
    Hove, England
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Variable filename

    Fantastic, thanks.
    I don't know why I didn't think of that.

    mgreenop

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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