简体   繁体   English

将单元格中的数字取一部分,然后将剩余部分移至另一个单元格+ excel公式

[英]take part of number in cell and move the remaining to another cell + excel formula

I need to divide one number into sum of two numbers .. in my example (Calculating end of service benefits) I need to divide 13 years to 5 years in cell and 8 years in cell for example .. if the total years = 4 years it should be divided into 4 and 0 and so on .. 我需要将一个数字除以两个数字的总和..在我的示例中(计算服务终止收益),例如,如果总年数= 4年,则需要将单元格的13年划分为5年,单元格的划分为8年。它应该分为4和0,依此类推..

      A           B               C                 D                E
 start date | End date  | number of years  | first 5 years  | Remaining years
 5/5/2010     6/3/2016          5                 5                  0
 4/3/2000     7/7/2013          13                5                  8
 3/6/1998     13/5/2016         17                5                  12
 1/1/2013     2/3/2016          3                 3                  0

How could we calculate D & E columns .. any help will be appreciated .. thanks in advance 我们如何计算D&E列..任何帮助将不胜感激..预先感谢

Set formula in D as (for instance, D2): 将D中的公式设置为(例如D2):

=IF(C2 > 5 , 5 , C2)

and in column E: 并在E列中:

=IF(C2 > 5 , C2 - 5 , 0)

Then, drag the formula down to cover your whole range (eg from D2/E2 to D5/E5). 然后,向下拖动公式以覆盖整个范围(例如,从D2 / E2到D5 / E5)。

暂无
暂无

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

相关问题 Excel向导:如何创建一个公式,以将数字的一部分乘以一个单元格,另一部分乘以另一个 - Excel Wizards: How to create a formula for multiplying parts of a number by one cell, and another part by another 根据另一个单元格值更改部分 Excel 公式 - Changing part of an Excel formula based on another cell value Excel公式:如何将一个单元格的一部分与另一个单元格的一部分匹配并汇出匹配的单元格的值 - Excel Formula: How to match a part of one cell to the part of another and remit the matched cell's value 如果在另一个单元格中输入了某个值,是否有一个Excel公式填充多个单元格? - Is there an Excel formula that populates a number of cells, if a certain value is entered in another cell? 使用Excel公式查找ID号并复制到另一列中的单元格 - Locating ID number and copying to cell in another column using Excel Formula 单元格值更改后,移动到另一个单元格并在该单元格中执行公式 - Upon cell value change, move to another cell & execute formula in that cell 在 Excel 中引用另一个单元格公式的公式 - Formula to Reference another Cell's Formula in Excel Excel公式-自动添加单元格+1计数(第2部分) - Excel Formula - Auto Add cell +1 counting (part 2) 在公式中引用另一个单元格中的变量值 - Reference a variable value in another cell as part of formula 当另一个单元格数值是某个数字时,用于输入新单元格数值的 Excel 公式 - Excel Formula for Entering a New Cell Numerical Value When Another Cell Numerical Value is Some Number
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM