Just as the title suggests, I am using a texjoin in a larger function in order to keep a running history of sorts. The issue is that when I edit cells unrelated to the formula, the texjoin feature activates creating duplicates. I am not against using vba code however I would like to keep my functions concise.
正如标题所示,我在一个更大的函数中使用了一个文本联接,以便保持某种运行历史。问题是,当我编辑与公式无关的单元格时,纹理连接功能会激活创建重复项。我不反对使用VBA代码,但是我想让我的函数保持简洁。
The formula in question.(home cell is B1)
=IF(NOT($A1=""),TEXTJOIN("",TRUE,$B1," ",$A1,"*",TEXT($P$2,"mm/dd/yyy")," ",$R$1), IF($B1=0," ", " "))
正在讨论的公式。(主单元格为B1)=IF(NOT($A1=“”),TEXTJOIN(“”,TRUE,$B1,“”,$A1,“*”,TEXT($P$2,“mm/dd/yyy”),“”,$R$1),IF($B1=0,“”,“”))
Thanks for any advice!
谢谢你的建议!
EDIT: an explanation of what this is trying to do. Basically if there is something in a1 then attempt to concatenate that with what is already in b1 and add the current date and the username initials(referenced from a table for ease)
编辑:对这是要做什么的解释。基本上,如果a1中有内容,则尝试将其与b1中已有的内容连接起来,并添加当前日期和用户名首字母(为了方便起见,请从表格中引用)
Apparently the date function is volatile. I'm assuming using vba script to get a username is also volatile. Does that influence the issues I'm experiencing?
显然,Date函数是不稳定的。我假设使用VBA脚本获取用户名也是不稳定的。这对我正在经历的问题有影响吗?
更多回答
Is the circular reference in B1's formula intentional? Referencing the cell itself may create unintended results.
B1‘S公式中的循环引用是故意的吗?引用单元格本身可能会产生意外的结果。
If any of the cells referenced by your formula contain a Volatile function, your formula becomes Volitile as well. Perhaps P2 contains a Volatile Date function?
如果您的公式引用的任何单元格包含Volitile函数,您的公式也会变为Volitile。也许P2包含一个易变的日期函数?
So to clarify, I'm trying to use this formula in an attempt to create a automated "history" of changes, and that requires the cell referencing itself. Or so I think. Now what about a volatile function makes the textjoin function activate when any changes are made anywhere in the sheet?
所以为了澄清,我试图使用这个公式来尝试创建一个自动的更改“历史”,这需要单元格引用自己。至少我是这么认为的。现在,当工作表中的任何地方进行任何更改时,使TextJoin函数激活的Volatile函数又如何呢?
优秀答案推荐
TLDR: formulas aren't going to work for you here. Switch to VBA using a Worksheet_Change
event.
TLDR:公式在这里对你不起作用。使用WORKSHEET_CHANGE事件切换到VBA。
... TextJoin activating when editing unrelated cells. No, it's not.
..。TextJoin在编辑无关单元格时激活。不,它不是。
It activating (aka calculating) because it's part of a formula that includes a reference to a cell containing a Volatile formula. Excel regards a Volatile function as changed every time a sheet calculates. So every cell that contains a Volatile function, or a reference to a cell containing a Volatile function (recursively) is calculated.
它被激活(又名计算),因为它是公式的一部分,其中包括对包含易失性公式的单元格的引用。每次工作表计算时,Excel都会将易失性函数视为更改。因此,将计算包含可变函数的每个单元格,或对包含可变函数的单元格的引用(递归)。
Re VBA functions (UDF's), they not Volatile by default ( they can be made Volatile by using Application.Volitile
)
对于VBA函数(UDF),默认情况下它们不是易失性的(可以使用Application.Volitile使它们成为易失性的)
更多回答
我是一名优秀的程序员,十分优秀!