简体   繁体   English

Excel如何替换值? 透明吗?

[英]Excel How can I replace values? TRANSPOSE?

I have several values in my excel sheet that should be replaced with others. 我的Excel工作表中有几个值应该替换为其他值。 Whenever there's for example "Test 1", I need to have "Application System 1.0". 例如,无论何时有“测试1”,我都需要拥有“应用系统1.0”。 I am going to do an Export with the data, that contains "Test 1". 我将使用包含“测试1”的数据进行导出。 Then I want to have in all my analysises instead of "Test 1" "Application System 1.0". 然后,我要在所有分析中使用“ Test 1”“ Application System 1.0”。 Do you think theres a macro necessary? 您认为有必要使用宏吗? Or can I insert in every cell where I want to have "Application System 1.0" a formula? 还是可以在要具有“ Application System 1.0”公式的每个单元格中插入一个公式? I thought of the formula "TRANSPOSE"? 我想到了“ TRANSPOSE”这个公式吗? So maybe I could do a mapping with the corresponding values? 所以也许我可以使用对应的值进行映射? The problem is, that I generate the value "Test 1" with another formula. 问题是,我用另一个公式生成了值“ Test 1”。

=IF(ISERROR(VLOOKUP($I11,Export!$B:$AW,MATCH($J$1,Export!$B$4:$AW$4,0),0)),"",VLOOKUP($I11,Export!$B:$AW,MATCH($J$1,Export!$B$4:$AW$4,0),0))

So when I have a certain number in a cell, the right "Test x" appears in the cell. 因此,当我在某个单元格中有某个数字时,右侧的“测试x”将出现在该单元格中。 Though now, I don't want to have "Text x" anymore, but "Application System 1.0". 虽然现在,我不想拥有“文本x”,但不再需要“应用程序系统1.0”。 In addition I can't work with the "Application System 1.0" because I get the values "Test x" as I said before, from an export. 另外,我无法使用“ Application System 1.0”,因为我从导出中获得了如前所述的值“ Test x”。 I don't have any influence on that. 我对此没有任何影响。

Thank you very much in advance! 提前非常感谢您! Kind regards, question 亲切的问候,问题

Prior to exporting the data from Excel, save your file and run this short macro: 从Excel导出数据之前,请保存文件并运行以下简短宏:

Sub FixText()
    Application.ScreenUpdating = False
    For Each r In ActiveSheet.UsedRange
        v = r.Text
        If v <> "" Then
            If InStr(1, v, "Test 1") > 0 Then
                r.Value = Replace(v, "Test 1", "Application System 1.0")
            End If
        End If
    Next r
    Application.ScreenUpdating = True
End Sub

Note that you should save first since the macro will replace any formulas that result in text containing "Test 1". 请注意 ,您应该保存,因为宏将替换所有导致文本包含“ Test 1”的公式。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM