To retrieve all results from formulas in one row from a workbook and return it exactly in another workbook without errors, you'll want to use a combination of Excel features. Typically, you would use cell references that link to the original workbook, and these references will pull the data from the specified row.
Suppose that you have two workbooks:
SourceWorkbook.xlsx - contains the worksheet named Sheet1 with formulas you want to reference located in row 2.
DestinationWorkbook.xlsx - where you want to display the results of the formulas from the SourceWorkbook.xlsx.
While you could manually write references for each cell, if you want to copy an entire row, you might end up with a very long formula. Here's what you can do to achieve this without writing formulas for each cell individually:
- Open both workbooks,
SourceWorkbook.xlsx and DestinationWorkbook.xlsx.
- Go to the
DestinationWorkbook.xlsx where you want to return the results.
- Click on the cell in the row where you want to start returning the results (e.g., A1).
- Type an equal sign
= to start the formula, and then switch to the SourceWorkbook.xlsx window.
- Click on the first cell in the row with a formula that you want to link (e.g.,
Sheet1 cell A2).
- Press Enter. This will create a link to that cell from the
DestinationWorkbook.xlsx.
- Drag the fill handle (small square at the bottom right corner of the cell) across to the right to copy this formula to other cells in the same row in
DestinationWorkbook.xlsx. Excel will adjust the formula references automatically for each subsequent cell.
The resulting formula in DestinationWorkbook.xlsx for cell A1 will look something like this:
=[SourceWorkbook.xlsx]Sheet1!A2
And when you drag the formula to the right, Excel will increment column letters accordingly for cells B1, C1, etc.:
B1: =[SourceWorkbook.xlsx]Sheet1!B2
C1: =[SourceWorkbook.xlsx]Sheet1!C2
...
However, bear in mind that linking between workbooks requires that both workbooks should be open to properly update the values, or the source workbook's location should not change. If the source workbook is closed or moved, Excel will try to maintain the links but will not update the values until the source workbook is reopened or the link path is corrected.
Additionally, errors can't be "avoided" per se; if there's an error in the source workbook, it'll be reflected in the destination workbook. To manage errors, you can wrap each reference in an IFERROR function:
=IFERROR([SourceWorkbook.xlsx]Sheet1!A2, "Error in source")
If you're dealing with very large datasets or if the row contains many columns with formulas, you may want to consider using more advanced techniques, such as Power Query, to manage the data transfer more efficiently.