+ Reply to Thread
Results 1 to 4 of 4

How to "lock" "ranges when copying a cell

  1. #1
    Registered User
    Join Date
    08-23-2010
    Location
    Oulu,Finland
    MS-Off Ver
    Excel 2007
    Posts
    17

    How to "lock" "ranges when copying a cell

    Hi,

    I'm doing a warehouse-related worksheet which lists stuff going in and out and inside the warehouse on a week-to-week basis. I (thought I) did the easy and less likely to go crazy version by simply listing the weeks in column A and then have a column for each product in each warehouse going in, out, and whats in the warehouse at the start of each week.
    I then basically have a function for each cell doing something like this:

    =SUM((Sheet1!E4:E100=A5)*(Sheet1!M4:M100="warehouse1")*Sheet1!F4:F100)

    The thing is I have 1953 individual cells which each require unique functions, for this column the A5 changes from A2 to A100. For other cells the changing part is different for each.
    Some of you might have already figured out what the problem is. But here we go:

    Is there a way to LOCK some ranges/cells when copy-pasting the cell into other cells? Copypasting the function down the colum changes A5 into A6,A7 etc wonderfully but what it also does is it breaks up the ranges since E4:E100 turns into E5:E101 etc. Manually editing the function for each of the 1953 cells would take bit too much of my time if there is an easier method

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How to "lock" "ranges when copying a cell

    do you mean
    =SUM((Sheet1!$E$4:$E$100=A5)*(Sheet1!$M$4:$M$100="warehouse1")*Sheet1!$F$4:$F$100)
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    09-05-2007
    Posts
    19

    Re: How to "lock" "ranges when copying a cell

    As per Martin's post. To expand, the $ essentially locks the cell reference - so it's not increased as dragged to new cells. You need to "lock" both the column (i.e. E) and row (i.e. 4) individually - so $E4 locks only the column allowing the row to increase, whilst $E$4 locks them both; E$4 locks only the row, hence allowing the column to increase.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How to "lock" "ranges when copying a cell

    If you don't want to be confirming your formula with CTRL+SHIFT+ENTER then perhaps edit it to:

    =SUMPRODUCT((Sheet1!$E$4:$E$100=A5)*(Sheet1!$M$4:$M$100="warehouse1")*Sheet1!$F$4:$F$100)

    and confirm it with the regular ENTER only.

    And further, if you are in 2007 as per your profile:

    =SUMIFS(Sheet1!$F$4:$F$100,Sheet1!$E$4:$E$100,A5,Sheet1!$M$4:$M$100,"warehouse1")

    with ENTER only.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

+ 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