Microsoft Excel - 如何自动填充列中的公式?
寿命、员工 ID、开始日期、结束日期
我将一堆数据粘贴到工作表(单元格 B1-Dn)中,并且我需要 A1-An(寿命)的公式来自动计算输入的每个员工的结果。
我正在使用 Microsoft Excel 2010。
目前,我使用的公式是:
=IF ( C1 , IF ( D1 , D1-C1 , TODAY()-C1 ) , "")
这非常有效,只是我必须在 A 列中手动添加/删除具有此公式的单元格,以匹配在任何给定输入的行数时间。这非常耗时,并且管理层在使用此报告时很难理解。 :)
有没有办法说“每行有数据,在A列中得到这个公式”?
我一直在网上研究这个问题,并找到了各种答案。最突出的答案是使用带有默认值的下拉列表,但我认为这不适用于默认公式。
Longevity, EmployeeID, StartDate, EndDate
I paste a bunch of data into the worksheet (cells B1-Dn), and I need the formula for A1-An (longevity) to automatically calculate the result for each employee that is entered.
I am using Microsoft Excel 2010.
Currently, the formula that I am using is:
=IF ( C1 , IF ( D1 , D1-C1 , TODAY()-C1 ) , "")
This works great, except that I have to manually add/remove cells with this formula in the A column to match the number of rows that are entered at any given time. This is very time-consuming, and difficult for Management to get their heads around when using this report. :)
Is there a way to say "Every row with data in it, gets THIS formula in column A"?
I've been researching this online, and found various answers. The most prominent answer was to use a drop-down-list with a default value, but I don't think that will work for a default formula.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用数据表应该可以帮助您确保您的公式涵盖整个范围。
第一步:
粘贴您的数据(无公式)
第二步:转到插入 ->表中,您应该会看到一个类似于
的对话框,现在将您的公式放在相邻的列中。您会注意到表格格式将自动扩展到公式所在的位置,并且公式将自动复制到数据集的底部。
第三步:
将更大的数据集复制到表中...您会注意到公式会随新的扩展数据集一起复制下来。
请注意,如果粘贴较小的数据集,表格的大小不会调整。
Using Data tables should help you out with ensuring that your formulas cover the entire range.
Step one:
Paste your data (no formulas)
Step two: Go to insert -> table you should get a dialog that looks something like
Now put your formula in the adjacent column. You will notice that the table formatting will automatically expand into where your formula is, and that the formula will auto copy to the bottom of your data set.
Step three:
Copy a larger dataset into the table.... you will notice that the formula copies down with your new extended data set.
Note that the table won't be resized if you paste a smaller dataset.
如果我正确理解你需要什么,那么也许你应该尝试这个。
在 A 列的每个单元格中(如果其他列包含数据,则需要在其中显示公式)添加此公式:
更准确地说,您应该在 A1 单元格中添加此公式,然后自动填充所有 A 列。
或者,您可以尝试在 A1 单元格中设置以下公式,然后自动填充 A 列的其余部分。
If I understand correctly what you need, then maybe you should try this.
In the every cell of column A (where you need the formula to be present if other columns contain data) add this formula :
To be more exact, you should add this formula in the A1 cell, and then auto fill all the A column.
Alternatively you could try setting the formula below in A1 cell and then auto fill the rest of the A column.