【问题标题】:Separate some values by brackets and decrease a number from a column to another column用括号分隔一些值并将数字从一列减少到另一列
【发布时间】:2015-03-09 22:37:58
【问题描述】:

我在不同的列中有这些值的输入:

First column   Second Column    Third column
72              54,72            35,43
63              63,70,74         41
39              32,39,49         51

从这个表中我需要这样的输出:

First_output   Second_output      Third_output
50              54,35,43          [50,54][54][35,43]
50              70,74,41          [50,70,74][70,74][41]
50              32,49,51          [50,32,49][32,49][51]

First_output 我用 if(First column>100,First column,50),
second_output 和 third_output 对我来说有点头疼,我已经尝试过使用连接的方法,但是对于不同的场景,我无法摆脱 First 列。

规则:

  • First_output 将变为 50,而不是 72、63、39
  • Second_output 将成为连接的第二列和第三列 但第一列中没有数字(72、63、39)
  • Third_output 将变为,在括号中:第一个括号包含第二个 列,但正如我所说,72、63、39 将变为 50,这就是我有 这些数字,第二个括号包含相同的数字,没有 50,第三个括号包含第三列。

【问题讨论】:

  • 你想用 2nd 和 3rd 实现什么?
  • 我在您的输出数据中没有看到模式。数字从何而来?
  • 基本上第一列是 50,如果我在第三列中有 2 个数字,我需要将它们放在第三列末尾的括号中,例如,我需要在第一列的第一行中删除我将更改为编号 50 的列,在 second_column 中我需要连接第二列和第三列但没有第一列编号
  • 请写下规则,完全不清楚第 2 列和第 3 列应该是什么,
  • @AndreiVieru 你很乐意使用 vba 吗?

标签: excel excel-formula worksheet-function substitution vba


【解决方案1】:

假设First column 在 A1 中,而不是 VBA 中,在 D2 中:

50  

在 E2 中:

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(B2&","&C2,A2,","),",,,",","),",,","")  

在 F2 中:

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE("[50,"&SUBSTITUTE(B2,A2,"")&"]["&SUBSTITUTE(B2,A2,"")&"]["&C2&"]",",,",","),",]","]"),"[,","[")  

并复制所有三个以适合。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-18
    • 1970-01-01
    • 1970-01-01
    • 2020-12-23
    • 1970-01-01
    • 1970-01-01
    • 2022-07-07
    相关资源
    最近更新 更多