简体   繁体   English

Excel公式:如何将一个单元格的一部分与另一个单元格的一部分匹配并汇出匹配的单元格的值

[英]Excel Formula: How to match a part of one cell to the part of another and remit the matched cell's value

I am trying to create a formula that will look in the range of date cells (C23:C28) and see if any of them contain the same month as the month listed in date cell B33. 我正在尝试创建一个公式,该公式将在日期单元格(C23:C28)的范围内查找,并查看它们是否包含与日期单元格B33中列出的月份相同的月份。 If so, I need it to remit the exact date listed in the matched cell (in column C). 如果是这样,我需要它汇出匹配单元格(在C列中)列出的确切日期。 Any insight will help. 任何见解都会有所帮助。 Thanks! 谢谢!

Try this formula 试试这个公式

=IFERROR(INDEX(C23:C28,MATCH(B33-DAY(B33)+1,INDEX(C23:C28-DAY(C23:C28)+1,0),0)),"No match")

The formula converts all dates (B33 and C23:C28) to the 1st of the relevant month and then makes the comparison - if any match (by year and month) you get the first of those matches (in order of placement in C23:C28). 该公式将所有日期(B33和C23:C28)转换为相关月份的第一天,然后进行比较-如果有任何匹配项(按年份和月份),则获得这些匹配项中的第一个(按在C23:C28中的位置顺序) )。 If there are no matches you get "No match" 如果没有匹配项,您将获得“没有匹配项”

You might be able to simplify if, say, all your dates will always be 1st of the month 例如,如果您的所有日期始终是该月的1号,则可以简化操作

Try: 尝试:
=MIN(IF(MONTH(C23:C28)=B33,C23:C28)) = MIN(IF(MONTH(C23:C28)= B33,C23:C28))
To return the lowest date matching the month in B33. 返回与B33中月份匹配的最低日期。 Enter using [ctrl]+[shift]+[enter]. 使用[ctrl] + [shift] + [enter]输入。

Using MAX does also require cse: 使用MAX还需要cse:
=MAX(IF(MONTH(C23:C28)=B33,C23:C28)) = MAX(IF(MONTH(C23:C28)= B33,C23:C28))
Or it will be in error without [ctrl]+[shift]+[enter]. 否则,如果没有[ctrl] + [shift] + [enter],它将是错误的。

暂无
暂无

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

相关问题 根据另一个单元格值更改部分 Excel 公式 - Changing part of an Excel formula based on another cell value Excel向导:如何创建一个公式,以将数字的一部分乘以一个单元格,另一部分乘以另一个 - Excel Wizards: How to create a formula for multiplying parts of a number by one cell, and another part by another 将单元格中的数字取一部分,然后将剩余部分移至另一个单元格+ excel公式 - take part of number in cell and move the remaining to another cell + excel formula 如何使用单元格的值(字符串)作为 Excel 中公式的一部分(不在宏中)? - How to use a cell's value (string) as part of a formula in Excel (not within a macro)? 在公式中引用另一个单元格中的变量值 - Reference a variable value in another cell as part of formula 如何仅匹配单元格值的一部分而不是 VBA 中的 Excel 的完全匹配? - How to Match just part of a cell's value instead of an exact match in VBA for Excel? 使用另一个单元格的值动态替换单元格公式的一部分 - Replace part of a cell formula dynamically using value of another cell 根据另一个单元格中的值编辑一个单元格中的部分文本的公式 - Formula to edit part of a text in one cell based on an values in another cell Excel:替换单元格的字符串值的一部分 - Excel: replace part of cell's string value 在Excel VBA中使用单元格值(文本)作为公式的一部分 - Use a cell value (text) as a part of a formula in Excel VBA
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM