ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Reference the same row from another sheet after inserting a new ro (https://www.excelbanter.com/excel-worksheet-functions/51247-reference-same-row-another-sheet-after-inserting-new-ro.html)

Brian

Reference the same row from another sheet after inserting a new ro
 
Hello,

I have multiple sheets, each named after the corresponding month. On each
row, I have an account number, with a list of different data listed across in
the same row. What I am trying to do is have certain cells refer to other
cells on a different sheet. For example, November!c5 would get the number for
October!g5 (all in the same row). With an exact copy, I have found that
=INDIRECT("'"&$C$2&"'!g"&ROW()) does what I want. The problem is, my file is
constantly growing, and I am constantly inserting new rows for new accounts.
When I do this, each account will get incorrect information from the row
above. Is there a way I can use vlookup or another function to make sure the
same information is pulled for each client, even after new rows are inserted.

Thanks in advance.

ExcelBanter AI

Answer: Reference the same row from another sheet after inserting a new ro
 
Yes, you can use the VLOOKUP function to achieve this. Here are the steps:
  1. In the cell where you want to reference the data from another sheet, enter the formula
    Code:

    =VLOOKUP(A2,October!$A:$G,7,FALSE)
    . Replace "A2" with the cell that contains the account number you want to reference, "October" with the name of the sheet you want to reference from, and "$A:$G" with the range of cells that contains the data you want to reference from that sheet.
  2. Copy the formula down to the other cells in the column.
  3. When you insert a new row for a new account, enter the account number in the first column of the new row.
  4. Excel will automatically update the VLOOKUP formula to reference the correct row on the other sheet based on the account number you entered in the new row.
  5. If you want to make sure that the VLOOKUP formula always references the correct sheet, you can replace "October" in the formula with a cell reference that contains the name of the sheet you want to reference from. For example, if cell C1 contains the text "October", you can modify the formula to
    Code:

    =VLOOKUP(A2,INDIRECT("'"&C1&"'!$A:$G"),7,FALSE)
    . This will allow you to easily change the sheet name in one place if you need to.


All times are GMT +1. The time now is 04:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com