我正在连接excel表格中每行的每一列,我已经完成了每列的连接。 我的问题是我只需要在第3行第3行连接不包含字母T的行。请参见下图
示例公式
= Sheet 1中A3&安培;!Sheet 1中B3&安培;!Sheet 1中C3&安培;!Sheet 1中D3&安培;!Sheet 1中E3&安培;!Sheet 1中F3&安培;!Sheet 1中G3&安培;!Sheet 1中H3&安培;!Sheet 1中I3&安培;!Sheet 1中J3&安培;!Sheet 1中K3&安培; Sheet 1中! L3&安培;!Sheet 1中M3&安培;!Sheet 1中N3&安培; Sheet 1中
在该图像上,您可以从上面的详细信息中看到连接列的下面结果,但并不是所有连接的行都具有相同的数字(就像上面只有3行的图像一样)计算机),你知道这个问题的一些代码或公式吗?
答案 0 :(得分:1)
你可以尝试
=TEXTJOIN(A1:N1)
或者你的范围应该是什么。 但是在VBA中动态地完成它:
Dim row, col As Integer
Dim curStr As String
row = 1
col = 1
curStr = ""
Do While Sheets("Input").Cells(row, col) <> ""
Do While Sheets("Input").Cells(row, col) <> ""
curStr = curStr + Sheets("Input").Cells(row, col)
col = col + 1
Loop
col = 1
Sheets("Output").Cells(row, col) = curStr
row = row + 1
curStr = ""
Loop
答案 1 :(得分:0)
使用此UDF - User Defined Function
Function conc(rangetoconc As Range) As String
Dim finalresult As String
Dim cell As Range
finalresult = vbNullString
If InStr(1, rangetoconc.Cells(1, 1), "T") = 0 Then
For Each cell In rangetoconc
If CStr(cell.Value) <> vbNullString And CStr(cell.Value) <> " " Then
finalresult = finalresult & CStr(cell.Value)
End If
Next
End If
conc = finalresult
End Function
答案 2 :(得分:0)
在网上阅读了一些excel公式之后,我刚刚想出了我的问题的答案。
= IF(A1 =&#34;&#34;&#34;&#34 ;, IF(LEFT(A1,1)=&#34; T&#34;&#34;&#34 ;, IF(&#39;工作表Sheet&#39;!A2&LT;&GT;&#34;&#34;&#39;工作表Sheet&#39;!A2&安培;&#39;工作表Sheet&#39;!B2&安培;&#39;工作表Sheet1&#39;!C2和放大器;&#39; Sheet1中&#39;!D2及放大器;&#39; Sheet1中&#39;!E2和放大器;&#39; Sheet1中&#39;!F2和放大器;&#39; Sheet1中&#39;!G2和放大器;&#39; Sheet1中&#39;!H2和放大器;&#39; Sheet1中&#39;!I2和放大器;&#39; Sheet1中&#39;!J2和放大器;&#39; Sheet1中&#39;!K2和放大器;&#39;工作表Sheet1& #39;!L2&放大器;&#39; Sheet1中&#39;!M2和放大器;&#39; Sheet1中&#39;!N2和放大器;&#39; Sheet1中&#39;!O2和放大器;&#39; Sheet1中&#39;!P2和放大器; &#39; Sheet1&#39;!Q2&amp;&#39; Sheet1&#39;!R2&amp;&#39; Sheet1&#39;!S2,&#34; T&#34;&amp; MIN(ROW(A2: A3))+行(A2)-3&amp;&#34;发票总和&#34;&amp; SUM(&#39; Sheet1&#39;!H:H))))