如何在几个单元格中自动插入= if('公式已经在单元格中'='"","','公式已在单元格中')? [英] How to insert automatically =if('formula already in cell'="","",'formula already in cell') in several cells?
问题描述
大家好,
Hi all,
我最初填充了一张主表格,其中包含很多= INDIRECT()公式,可以从其他标签中获取数据。我后来发现,如果数据为空,则INDIRECT返回零。这里的问题是我从中获取的数据已经有一些
零,所以我希望空白在我的主表中留空,为了做到这一点,我发现函数= IF(INDIRECT()=" ;","",INDIRECT())。
I have initially populated a master sheet with a lot of =INDIRECT() formulas that picks up data from other tabs. What I found later is that INDIRECT returns zeros if the data is blank. The problem here is that my data I am picking up from already has some zeros so I want the blanks to stay blanks in my master sheet and in order to do so I found the function =IF(INDIRECT()="", "" , INDIRECT()).
如何在已经= INDIRECT()的单元格中自动插入上述IF函数?  ;
How can I automatically insert the above-mentioned IF function in the cells that already have =INDIRECT()?
我尝试使用这个适用于0.333的VBA代码但是当我用"""替换它时会出现错误。
I tried using this VBA code which works with 0.333 but it gives me an error when I replace it with "".
非常感谢!
Many thanks !
推荐答案
你必须在引用的字符串中加双引号,所以空字符串"""成为"""":
You have to double quotes inside quoted strings, so an empty string "" becomes """":
a =" = IF(& Mid(R.Formula,2)&" =""" ;","""","& Mid(R.Formula,2)&")"
a = "=IF(" & Mid(R.Formula, 2) & "="""",""""," & Mid(R.Formula, 2) & ")"
这篇关于如何在几个单元格中自动插入= if('公式已经在单元格中'='"","','公式已在单元格中')?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!