简体   繁体   English

动态范围的Excel公式

[英]excel formula for dynamic range

I've created a report in excel. 我已经在Excel中创建了一个报告。 The intent is to paste the data into the data tab and refresh the workbook to populate all tabs that include charts, and pivot tables. 目的是将数据粘贴到“数据”选项卡中,并刷新工作簿以填充包括图表和数据透视表的所有选项卡。

I have additional columns that contain formulas that populate based on the data entered. 我还有其他列,其中包含根据输入的数据填充的公式。 Each extract will have a different number of rows, so I would like these columns to only populate based on the number of rows in the data entered. 每个提取将具有不同的行数,因此我希望仅根据输入数据中的行数来填充这些列。 Is there a way to do this and avoid having to drag down formulas or delete extra formulas? 有没有办法做到这一点,而不必拖累公式或删除多余的公式? Like a form of dynamic range? 喜欢动态范围的形式吗?

Example: Lets say my extract has 10 rows of data. 示例:假设我的数据提取有10行数据。 I have column A as open date and column B as closed date. 我将A列作为开放日期并将B列作为结束日期。 If I wanted to have column C automatically populate when the data is entered with turnaround time (closed date - open date), how could I do that only going 10 rows down? 如果我想在输入带有周转时间(关闭日期-打开日期)的数据时自动填充C列,那我该怎么做才能只向下移动10行呢?

Lets says the next weeks data extract has 20 rows...could I have column c populate all 20 rows this time without having to drag the formulas 10 more rows down? 让我们说下几周的数据提取有20行...这次我可以让c列填充所有20行而不必将公式向下拖动10行吗?

I prefer to do this without VBA but if necessary or easiest, that is fine...please help. 我更喜欢在没有VBA的情况下执行此操作,但是如果有必要或最简单的话,那很好...请帮助。

You can easily make this happen by using Excel Tables . 您可以使用Excel Tables轻松实现此目的。

Background on Excel Formatted Tables Excel格式表的背景

When you format your data table into an Excel Formatted Table, you'll notice that when referring to the table you'll get a different type of range reference. 当您将数据表格式化为Excel格式化表时,您会注意到,在引用该表时,您将获得另一种类型的范围引用。 No longer does the range say B3:B6 , it will say something like: [@Name] . 范围不再说B3:B6 ,而是说: [@Name] This is great for dynamic ranges since the number of rows is no longer relevant to the range: [@Name] ... Excel knows you are referring to ALL rows in [@Name] . 这对于动态范围非常有用,因为行数不再与该范围相关: [@Name] ... Excel知道您引用的是[@Name]所有行。

How to Update your Table With new Values 如何用新值更新表

Let's say you setup your data as an Excel Table and there are 10 rows of data. 假设您将数据设置为Excel Table并且有10行数据。 The next day you want to update the data with a total of 20 rows. 第二天,您要更新总共20行的数据。 Simply Copy and Paste Special (Values) and the table will extend to 20 rows in height and will carry down any additional columns you have as formulas. 只需复制并粘贴特殊值(值),表格的高度将扩展到20行,并将保留您作为公式的任何其他列。 Piece of cake. 小菜一碟。 The problem will be removing rows when your data on day 3 is back down to 10 rows... you will need to manually delete the extra rows. 问题将是在第3天的数据减少到10行时删除行...您将需要手动删除多余的行。

Here's a screenshot of the difference: 这是区别的屏幕截图: Excel格式的表格范例-Cruter

To quickly setup an Excel Formatted Table , just press Ctrl + T within your block of data you want to convert and click OK . 要快速设置Excel Formatted Table ,只需在要转换的数据块中按Ctrl + T ,然后单击“ OK

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM