问题描述
{{ 3}}我正在为一家机构制作加班表。我制作了一张表格,其中我使用了 1 到 31 天的日期。然而,随着时间的推移,出现在随机的日子里。因此,我需要手动编写这几天。因此,如果将 OT 输入加班日期(OT = 加班),我想应用逻辑,然后该特定日期将显示在其他行中。有公式吗?
解决方法
我想我明白你想要达到的目标:
假设您在单元格 B9:AF9 中有一行日期
- 在单元格 B10:AF10 中根据需要输入“OT”
或者,如果你根据人们的名字输入“OT”,在那里添加一个公式来找出你是否有人在这个日期有 OT
=IF(COUNTIF(B11:B24,"OT")>0,"OT","")
或者如果您的 Excel 使用分号“;”不是逗号“,”:
=IF(COUNTIF(B11:B24;"OT")>0;"OT";"")
它会显示我们这一天是否有 OT。
- 在单元格 D30 中粘贴公式
=IFERROR(INDEX($B$9:$AF$9,1,SMALL(IF(($B$10:$AF$10="ot")*($B$9:$AF$9>0)>0,MATCH(COLUMN($A$9:$AE$9),COLUMN($A$9:$AE$9),0),""),COLUMN(A1))),"")
但将其作为数组公式插入,同时按 Ctrl+Shift+Enter。
如果您的 Excel 使用分号作为参数分隔符,请使用这个:
=IFERROR(INDEX($B$9:$AF$9;1;SMALL(IF(($B$10:$AF$10="ot")*($B$9:$AF$9>0)>0;MATCH(COLUMN($A$9:$AE$9);COLUMN($A$9:$AE$9);0);"");COLUMN(A1)));"")
将其作为数组公式插入,同时按 Ctrl+Shift+Enter。
- 将其复制并粘贴到单元格 E30 - AH30。
它会给我们一个日期数组,您将“OT”放在上面的表格中。