+ Reply to Thread
Results 1 to 8 of 8

copy cell with formula containing the dollar

  1. #1
    Registered User
    Join Date
    11-09-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    19

    copy cell with formula containing the dollar

    Hi,

    sorry for this (maybe) obvious question. I have a quite long formula that contain the dollar function and I use it for calculating certain values across rows (so that one specific row is locked). Now I need to use the same formula (copy and paste) for calculating the same coefficients on the base of other rows which are far down the same sheet. Obviously the dollar keep the same row which is up on the sheet. Is there a way to copy and paste the formula so to lock the new row (same columns but different row) and do the same thing?

    It would save me a lot of time as I have dozens of matrix for which I have to apply the same formula

    Thank you

    Best

    Ted

  2. #2
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: copy cell with formula containing the dollar

    Could you provide us with 2 examples of the formula, 1 before and 1 after, so that we can see how you need it to change.

    Knowing which cells each of those formula will go into would also be useful.

  3. #3
    Registered User
    Join Date
    11-09-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: copy cell with formula containing the dollar

    Sure, this is the formula, that needs to be applied to a set of rows (B5 until B9 with B5 locked)

    =SQRT(($B$5-B5)^2+($C$5-C5)^2+($D$5-D5)^2+($E$5-E5)^2+($F$5-F5)^2+($G$5-G5)^2+($H$5-H5)^2+($I$5-I5)^2+($J$5-J5)^2+($K$5-K5)^2+($L$5-L5)^2+($M$5-M5)^2+($N$5-N5)^2)

    I need to this for lots of other matrices (rows B10 to B16, with B10 locked, B17 to B23 with B17 locked and so on for many others). Hope it is clearer, also that it would same me lots of time if there is a way to copy and paste so that when I copy the formula I have on B5, it will lock B10)

  4. #4
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: copy cell with formula containing the dollar

    Is the formula going in the same row as the data that the relative part refers to each time?

    For example, $B$5:B5 goes in row 5, $B$10:B10 goes in row 10, $B$10:B13 goes in row 13, etc.

    There will probably be better options using vba, but the only way I can think of with a formula would be based on this method, which relies on the formula being in the same row as the data.

    (INDEX($B:$B,ROW()-ROWS(B$1:B1)+1)-INDEX(B:B,ROW()))^2

    and that is just for the first column, that would need to be repeated in the formula for each of the other 12 columns

    When copying to a new range, you need to copy the actual text of the formula, not the cell.
    Last edited by jason.b75; 06-10-2016 at 08:01 AM.

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,197

    Re: copy cell with formula containing the dollar

    The first block has 5 rows "locked" (B5:B9) but then it changes to 7 (B10:B16) ???

  6. #6
    Registered User
    Join Date
    11-09-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: copy cell with formula containing the dollar

    I am desperate Just one row is blocked (the range changes but not what it need to be done, that is to calculate a distance between one row and a set of rows)

  7. #7
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,910

    Re: copy cell with formula containing the dollar

    Quote Originally Posted by Carmine View Post
    =SQRT(($B$5-B5)^2+($C$5-C5)^2+($D$5-D5)^2+($E$5-E5)^2+($F$5-F5)^2+($G$5-G5)^2
    +($H$5-H5)^2+($I$5-I5)^2+($J$5-J5)^2+($K$5-K5)^2+($L$5-L5)^2+($M$5-M5)^2+($N$5-N5)^2)
    Like this ...

    =SQRT(SUMPRODUCT(($B$5:$N$5-B5:N5)*($B$5:$N$5-B5:N5)))

  8. #8
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: copy cell with formula containing the dollar

    Quote Originally Posted by Phuocam View Post
    Like this ...

    =SQRT(SUMPRODUCT(($B$5:$N$5-B5:N5)*($B$5:$N$5-B5:N5)))
    Not entirely what was asked for, Phuocam, but you have found what I was missing.

    Combining your formula, with the method I had for defining the correct range,

    =SQRT(SUMPRODUCT((INDEX($B:$N,ROW()-ROWS(B$1:B1)+1,0)-INDEX(B:N,ROW(),0))*(INDEX($B:$N,ROW()-ROWS(B$1:B1)+1,0)-INDEX(B:N,ROW(),0))))

    Carmine, please note that you need to copy the formula when you paste to a new range, not the cell (copying the cell will cause the references to lock / increase the same as a normal formula would).

+ 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. Replies: 5
    Last Post: 03-04-2014, 10:01 AM
  2. [SOLVED] Formula to create a blank cell based on a dollar amount in another cell.
    By avidcat in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-07-2014, 02:11 AM
  3. Dollar Weighted YTD Formula
    By hzrdc2 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-18-2013, 04:52 PM
  4. formula to get constant dollar
    By BusterGA97 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-22-2012, 07:54 PM
  5. [SOLVED] How to copy formula without copying the dollar sign
    By Roshanexcel in forum Excel General
    Replies: 4
    Last Post: 08-12-2012, 06:41 PM
  6. Replies: 4
    Last Post: 09-14-2011, 06:23 PM
  7. Replies: 11
    Last Post: 02-20-2011, 10:46 PM
  8. Time Value * Dollar Value formula
    By Latlong in forum Excel General
    Replies: 4
    Last Post: 10-11-2009, 01:08 AM

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