+ Reply to Thread
Results 1 to 4 of 4

Edit Formula but Keep Existing Range

  1. #1
    Registered User
    Join Date
    08-02-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007
    Posts
    2

    Edit Formula but Keep Existing Range

    I currently have the following formula taking the sum of daily data and dividing by the number of productive hours for the week to get weekly utilization data:

    =SUM(FN36:FT36)/AA51

    When there are weeks with holidays or vacation, the formula throws an error and I'd like to clean it up and include the IFERROR statement in front and "),0)" on the end while moving the daily data to another tab in the workbook. The range highlighted in blue needs to stay as it is in every cell i.e.

    =IFERROR((SUM('Consolidated View - Daily'!FN36:FT36)/AA51),0)

    I'm relatively new to macros so I'm not sure if this is possible and I hope the post isn't too confusing. Thanks in advance for any assistance.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Edit Formula but Keep Existing Range

    You need to add $ symbols into your cell references to "lock" the parts that follow.

    FN36:FT36 - nothing locked
    $FN36:$FT36 - columns locked, rows not locked
    FN$36:FT$36 - row locked, columns not locked
    $FN$36:$FT$36 - row and columns locked
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    08-02-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Edit Formula but Keep Existing Range

    The real issue here isn't whether the cells are locked or not. Right now all of the daily and weekly data are on the same sheet. I am moving all of the daily information to a new sheet and adding error handling at the same time.

    I would just fill the series, but Excel is not picking up on the pattern. Since I am summing daily data into weekly data, the range in column A would be something like SUM(A36:G36), column B would be SUM(H36:N36), etc.

    There are several years worth of this data and it has never been cleaned up. The process would involve manually going into each column, changing the formula and filling the series. At last count there are several hundred columns and I'm hoping not to have to do it manually. I need to change "=SUM(" to "=IFERROR((SUM('Consolidated View - Daily'!" before the range and then add "),0)" after the range that is currently in each cell.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Edit Formula but Keep Existing Range

    I use a simple trick to get my formulas to adjust properly on their own for weird range needs like this...

    1) Enter the first formula for summing A36:G36.
    2) Now copy that cell 8 cells to the right and paste. The formula is now adjusted properly for column B.
    3) CUT/PASTE the cell from where you pasted back to the cell next to the first formula.
    4) Now copy the second cell 8 cells to the right and paste / cut / paste back to the cell next to the second cell.
    5) Repeat ad nauseum.

+ 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