https://warriorplus.com/o2/a/x8g6yk/0 be more attractive: How to Copy Formulas in Excel

mardi 9 août 2016

How to Copy Formulas in Excel

Excel makes it easy to copy your formula across an entire row or column, but you don't always get the results you want. If you end up with unexpected results, or those awful #REF and /DIV0 errors, read about absolute and relative cell references to understand what went wrong. But don't worry: you don't need to edit your 5,000 line spreadsheet cell by cell before you can copy-paste again. There are easy ways to get the formula to update automatically based on its location, or to copy it exactly without changing a single value.

EditSteps

EditCopying a Formula into Multiple Cells by Dragging

  1. Enter the formula into one cell. As with any formula, start with an = sign, then use whichever functions or arithmetic you'd like. We'll use a simple example spreadsheet, and add column A and column B together:
    579572 1 1.jpg

    10 9 =A1+B1 |row2 = row 2 20 8 |row3 = row 3 30 7 |row4 = row 4 40 6 }}

  2. Press enter to calculate the formula. Once you hit on your keyboard, the formula will be entered and calculated. Only the result (19) will be displayed, but the spreadsheet will still have the formula stored.
    579572 2 1.jpg

    10 9 19 |row2 = row 2 20 8 |row3 = row 3 30 7 |row4 = row 4 40 6 }}

  3. Click on the lower right corner of the cell to be propagated. Move your cursor to the lower right corner of the cell you just edited. The cursor will become a bold + sign.[1]
    579572 3 1.jpg
  4. Hold and drag along the column or row you're copying to. Keep your mouse button held down, and drag your cursor down the column, or across the row to be edited (highlight). The formula you entered will automatically be entered into the cells you've highlighted. Relative cell references will automatically update to refer to the cell in the same relative position. Here's our example spreadsheet, showing the formulas used and the results displayed:
    579572 4 1.jpg

    10 9 =A1+B1 |row2 = row 2 20 8 =A2+B2 |row3 = row 3 30 7 =A3+B3 |row4 = row 4 40 6 =A4+B4 }} 10 9 19 |row2 = row 2 20 8 28 |row3 = row 3 30 7 37 |row4 = row 4 40 6 46 }}

  5. Double click the plus sign to fill the entire column. Instead of click-and-dragging, move your mouse to the lower right corner, and double click when the cursor turns into a + sign. This will automatically copy the formula to the entire column.
    579572 5 1.jpg
    [2]
    • Excel will stop filling out the column if it sees an empty cell. If the reference data contains a gap, you will have to repeat this step to fill out the column below the gap.

EditCopying a Formula into Multiple Cells by Pasting

  1. Enter the formula into one cell. As with any formula, start with an = sign, then use whichever functions or arithmetic you'd like. We'll use a simple example spreadsheet, and add column A and column B together:
    579572 1 1.jpg

    10 9 =A1+B1 |row2 = row 2 20 8 |row3 = row 3 30 7 |row4 = row 4 40 6 }}

  2. Press enter to calculate the formula. Once you hit on your keyboard, the formula will be entered and calculated. Only the result (19) will be displayed, but the spreadsheet will still have the formula stored.
    579572 2 1.jpg

    10 9 19 |row2 = row 2 20 8 |row3 = row 3 30 7 |row4 = row 4 40 6 }}

  3. Click on the cell to be propagated and copy it (CTRL+C).
  4. Select the cells you want to copy the formula to. Click on one and drag up or down using your mouse or the arrow keys. Unlike with the corner drag method, the cells you are copying the formula to do not need to be adjacent to the cell you are copying from.
  5. Paste (CTRL+V).

EditCopying a Formula Exactly

  1. Use this method to quickly copy a formula without changing the cell references. Sometimes, you have a large spreadsheet full of formulas, and you want to copy them exactly. Changing everything to absolute cell references (as described in the section on cell references) would be tedious, especially if you just want to change them back again afterward. Use this method to quickly move formulas with relative cell references elsewhere without changing the references.[3] Here's our example spreadsheet, which needs to have column C duplicated to column D:
    579572 6 1.jpg

    944 Frogs =A1/2 |row2 = row 2 636 Toads =A2/2 |row3 = row 3 712 Newts =A3/2 |row4 = row 4 690 Snakes =A4/2 }}

    • If you're just trying to copy the formula in a single cell, skip to the last step ("Try alternate methods") in this section.
  2. Open the Find window. On most versions of Excel, you can find this by clicking the tab at the top of the Excel window, then clicking in the "Editing" portion of the tab.[4] You can also use the keyboard shortcut, CTRL F.
    579572 7 1.jpg
  3. Find and replace "=" with another character. Enter "=", click "Find All," then enter another character into the "Replace with" box. This will automatically turn all formulas (which always begin with =) into text strings beginning with some other character. Always use a character that you have not used in your spreadsheet. For example, replace it with # or &, or a longer string of characters, such as ##&.
    579572 8 1.jpg

    944 Frogs ##&A1/2 |row2 = row 2 636 Toads ##&A2/2 |row3 = row 3 712 Newts ##&A3/2 |row4 = row 4 690 Snakes ##&A4/2 }}

    • Do not use the characters * or ?, since these will make later steps more difficult.
  4. Copy and paste the cells. You may now select any cells you wish to copy, then paste them into another location. Since they are no longer interpreted as formulas, they will be copied exactly.
    579572 9 1.jpg

    944 Frogs ##&A1/2 ##&A1/2 |row2 = row 2 636 Toads ##&A2/2 ##&A2/2 |row3 = row 3 712 Newts ##&A3/2 ##&A3/2 |row4 = row 4 690 Snakes ##&A4/2 ##&A4/2 }}

  5. Use Find & Replace again to reverse the change. Now that you have the formulas where you want them, use the "Find all" and "Replace with" options to reverse your change. In our example, we'll look for the character string "##&" and replace it with "=" again, so those cells become formulas once again. You can now continue editing your spreadsheet as usual:
    579572 10 1.jpg

    944 Frogs =A1/2 =A1/2 |row2 = row 2 636 Toads =A2/2 =A2/2 |row3 = row 3 712 Newts =A3/2 =A3/2 |row4 = row 4 690 Snakes =A4/2 =A4/2 }}

  6. Try alternate methods. If the method described above does not work for any reason, or if you are worried about accidentally changing other cell contents with the "Replace all" option, there are a couple other methods you can try:
    579572 11 1.jpg
    • To copy a single cell's formula without changing references, select the cell, then copy the formula shown in the formula bar near the top of the window (not in the cell itself). Press to close the formula bar, then paste the formula wherever you need it.[5]
    • Press (usually on the same key as ~) to put the spreadsheet in formula view mode. Copy the formulas and paste them into a text editor such as Notepad or TextEdit. Copy them again, then paste them back into the spreadsheet at the desired location.[6] Press again to switch back to regular viewing mode.

EditUsing Relative and Absolute Cell References

  1. Use a relative cell reference in a formula. In an Excel formula, a "cell reference" is the address a cell. You can type these in manually, or click on the cell you wish to use while you are entering a formula. For example, the following spreadsheet has a formula that references cell A2:
    579572 12 1.jpg

    50 7 =A2*2 |row2 = row 3 100 |row3 = row 4 200 |row4 = row 5 400 }}

  2. Understand why they're called relative references. In an Excel formula, a relative reference uses the relative position of a cell address. For example: cell C2 has the formula “=A2”, which is a relative reference to the value two cells to the left. If you copy the formula into cell C4, then it will still refer to two cells to the left, now showing “=A4”.
    579572 13 1.jpg

    50 7 =A2*2 |row2 = row 3 100 |row3 = row 4 200 =A4*2 |row4 = row 5 400 }}

    • This works for cells outside of the same row and column as well. If you copied the same formula from cell C1 into cell D6 (not shown), Excel would change the reference "A2" to a cell one row to the right (C→D) and 5 rows below (2→7), or "B7".
  3. Use an absolute reference instead. Let's say you don't want Excel to automatically change your formula. Instead of using a relative cell reference, you can make it absolute by adding a $ symbol in front of the column or row that you want to keep the same, no matter where you copy the formula too.[7] Here are a few example spreadsheets, showing the original formula in larger, bold text, and the result when you copy-paste it to other cells:
    579572 14 1.jpg

    50 7 =B$3 |row2 = row 2 100 =A$3 =B$3 |row3 = row 3 200 =A$3 =B$3 |row4 = row 4 400 =A$3 =B$3 }} 50 7 =$B1 |row2 = row 2 100 =$B2 =$B2 |row3 = row 3 200 =$B3 =$B3 |row4 = row 4 400 =$B4 =$B4 }} 50 7 =$B$1 |row2 = row 2 100 $B$1 $B$1 |row3 = row 3 200 $B$1 $B$1 |row4 = row 4 400 $B$1 $B$1 }}

  4. Use the key to switch between absolute and relative. Highlight a cell reference in a formula by clicking it. Press on your keyboard, and $ symbols will automatically be added or removed. Keep pressing until the absolute or relative references you'd like are selected, then hit .[8]
    579572 15 1.jpg

EditVideo

EditTips

  • If you copy a formula to a new cell and see a green triangle, Excel has detected a possible error. Examine the formula carefully to see if anything went wrong.[9]
  • If you accidentally did replace the = character with ? or * in the "copying a formula exactly" method, searching for "?" or "*" will not give you the results you expect. Correct this by searching for "~?" or for "~*" instead.[10]
  • Select a cell and press (apostrophe) to fill it with the formula directly above it.[11]

EditWarnings

  • Different versions of Excel may not show exactly the same screenshots in the same ways as are displayed here.

EditRelated wikiHows

EditSources and Citations


Cite error: <ref> tags exist, but no <references/> tag was found




source How to of the Day http://ift.tt/2awqfMM

Aucun commentaire:

Enregistrer un commentaire

https://warriorplus.com/o2/a/x8g6yk/0

How to Calm an Aggressive Cat

An aggressive cat can be hard to deal with, but it's important to remember that the cat is either afraid or was poorly socialized as a ...

https://warriorplus.com/o2/a/x8g6yk/0