简体   繁体   English

从单个单元格中提取由逗号分隔的数据

[英]Extract data separated by a comma from a single cell

I have a spreadsheet with data relating to meetings . 我有一个包含会议数据的电子表格。 One of the cells has the name of meetings with the amount of participants under brackets as follows. 其中一个单元格具有会议名称,括号内的参与者数量如下。

Staff meeting (65), HR meeting (15), Pension meeting (4) 员工会议(65),人力资源会议(15),养老金会议(4)

There can be in between 1 to 9 meetings in a single cell. 在一个单元格中可以有1到9个会议。 I am looking for a way to extract each meeting name and number (all information between commas) in separate cells. 我正在寻找一种方法来提取单独的单元格中的每个会议名称和编号(逗号之间的所有信息)。

Does anyone know how can this be done? 有谁知道怎么做?

Select the column with the meetings. 选择包含会议的列。

Then select Text to Columns on the Data tab of the Ribbon. 然后在功能区的“数据”选项卡上选择“ Text to Columns ”。

Choose 'Delimited' and the 'Comma' as the separator. 选择“分隔”和“逗号”作为分隔符。

Excel is not very good at recursive programming with cell storage. Excel不太擅长使用单元存储进行递归编程。

The solution can be solved with 6 different formulas copied on a number of lines. 该解决方案可以通过在多行上复制的6种不同的公式来解决。 In this example: 在这个例子中:

Excel中的解决方案示例

The formulas are:
- in B2: =FIND(",",A$1,B1+1)
- in C2: =MID(A$1,B1+1,B2-B1-1)
- in D2: =FIND("(",C2)
- in E2: =FIND(")",C2)
- in F2: =MID(C2,1,D2-1)
- in G2: =MID(C2,D2+1,E2-D2-1)

These cells can be copied to the next lines without adaptation, because the line of A$5 is vertically anchored. 可以将这些单元格复制到下一行而不进行调整,因为A $ 5的行是垂直锚定的。

Explanation: 说明:

  • in column B a search is performed from the previous comma (starting with 0) until the last one (ending with LEN()+1). 在B列中,从前一个逗号(从0开始)到最后一个逗号(以LEN()+ 1结束)执行搜索。
  • in column C the string between the commas is separated 在C列中,逗号之间的字符串是分开的
  • in column D the location of the '(' character is found 在D列中找到'('字符的位置
  • in column E the location of the ')' character is found 在E列中找到')'字符的位置
  • in column F the text before the '(' character is selected 在F列中,选择'('字符前的文字
  • in column G the number between the '(' and ')' character is selected 在G列中,选择'('和')'字符之间的数字

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

相关问题 从单个单元格中提取由点分隔的数据 - extract data separated by dots from a single cell 在单个单元格中收集逗号分隔的数据 - Collecting comma separated data in a single cell 如何从 excel 中的单个单元格计算逗号分隔的特定值 - How to count comma separated specific value from a single cell in excel 一个列表中的五个随机项目放入一个单元格中,用逗号分隔 - Five random items from a a list into a single cell separated by a comma Excel:除以逗号分隔的单个单元格数字 - Excel: Dividing comma separated single cell numbers 从单元格中以逗号分隔的日期字符串中提取最小(最旧)日期 - Extract minimal (oldest) date from comma-separated string of dates from cell 从列的每个单元格中的逗号分隔列表中提取一个特定的键和值 - Extract one specific key and value from a comma separated list in every cell of a column 以逗号分隔数据的单元格上的索引匹配 - INDEX MATCH on a cell that has data separated by a comma 动态查找单元格中的多个值(逗号分隔)并将相应的 ID 返回到单个单元格(逗号分隔) - Dynamic Lookup for multiple values in a cell (comma separated) and return the corresponding ID to a single cell (comma separated also) 将数组中的多个excel值组合回一个单独的excel单元格逗号分隔中 - combine multiple excel values from an array back into a single excel cell comma separated
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM