Forum Discussion
MarmonDH735
Sep 01, 2023Copper Contributor
Updating a formula over 12 worksheets using Data from the previous worksheet
I have a problem. I am working on an inventory map for the whole year gathering incoming and outgoing data daily on each worksheet. 12 worksheets- 1 for each month Jan.- Dec. I have a formula that I ...
NikolinoDE
Sep 02, 2023Gold Contributor
You can achieve this by using structured references and the INDIRECT function in Excel. Structured references allow you to reference tables by name, and the INDIRECT function allows you to create a reference to a cell using text, which can be manipulated to refer to different worksheets.
Here is how you can set it up:
- Table Setup: Ensure that your data is structured in tables. Each month's data should be in a separate table with a meaningful name (e.g., "Jan," "Feb," etc.).
- Cell References: For your formulas, use structured references to refer to the tables. For example, if you have a table named "Jan" and you want to reference cell C1 in that table, you can use the structured reference Jan[C1].
- INDIRECT Function: In your formulas, you can use the INDIRECT function to dynamically build the references to the previous and next month's tables. For example, if you want to calculate a value for August based on the previous month's data (July) and the next month's data (September), you can use a formula like this in the August worksheet:
=INDIRECT(TEXT(TODAY(),"mmm") & "![C1]") + INDIRECT(TEXT(DATE(YEAR(TODAY()), MONTH(TODAY())+1, 1),"mmm") & "![C3]") - INDIRECT(TEXT(DATE(YEAR(TODAY()), MONTH(TODAY())+1, 1),"mmm") & "![C4]")
This formula uses the TEXT function to create text references to the previous month (e.g., "Jul") and the next month (e.g., "Sep"). It then uses INDIRECT to convert these text references into actual cell references.
- AutoFill: Once you have set up the formula in the August worksheet, you can use the AutoFill handle (the small square at the bottom right corner of the selected cell) to copy the formula to the other months. Excel should automatically adjust the references based on the relative positions of the tables.
- Check and Adjust: After using AutoFill, double-check the formulas in each worksheet to ensure that the cell references are correct. Excel should have adjusted them correctly, but it is a good practice to verify.
By using this approach, you can create dynamic formulas that automatically update based on the current month and the tables' structured references, saving you the manual effort of changing the formulas in each worksheet.The text and steps were created with the help of AI.
My answers are voluntary and without guarantee!
Hope this will help you.