![](/img/trans.png)
[英]How to create a VBA formula that takes value and format from source cell
[英]How do I create a formula in excel that searches for a value in row, and then takes the value from another cell in that column?
我试图在excel中写一个公式,该公式基本上会说:如果您在row15中找到显示的单元格! ,然后将在Row2中该列顶部分配的日期值复制到新单元格。 我对Excel的知识不足,无法以正确的语言编写公式。
谢谢!
使用INDEX / MATCH:
=INDEX($2:$2,MATCH("!",15:15,0))
您可以先为变量定义一个单元格范围,然后对其进行引用并使用countif
函数查看某个值是否在范围内。 然后,您可以使用IF语句查看countif的值是否为true。 如果是这样,则打印任何您想要的。
range = F4:F10 # for example
=COUNTIF(range,'!')>0 #This returns true if it contains !
那么你可以抛出一个if语句来打印一些东西,如果为true
=IF(COUNTIF(range,'!'),"Yes","No") #It will print yes if the range contains '!'
如果需要,可以更改是和否输出以打印特定单元格。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.