将一个单元格的值转换为多个行,相同的ID值

时间:2017-05-08 21:49:06

标签: excel

我有一个这样的单元格:

930 "<h2>Crawford, 1963-</h2> [wpse_playlist type=""audio"" tracklist=""true"" tracknumbers=""true"" images=""true"" artist=""true""] [wpse_trac title=""Indian Summer"" src=""http://urlnamehere/bitstream/handle/2374.UC/731507 /Elliston_Marisa_Crawford_01-10-14_Track_01.mp3?sequence=7"" type=""audio/mpeg"" caption="""" description="""" meta_artist=""Crawford, Marisa & Pendarvis, Jack, 1963-"" meta_length_formatted="""" thumb_src="""" image_width=""300""][wpse_trac title=""The River"" src=""http://urlnamehere/bitstream/handle/2374.UC/731507/Elliston_Marisa_Crawford_01-10-14_Track_02.mp3?sequence=8"" type=""audio/mpeg"" caption="""" description="""" meta_artist=""Crawford, Marisa & Pendarvis, Jack, 1963-"" meta_length_formatted="""" thumb_src="""" image_width=""300""][wpse_trac title=""Swimming in Lanes Five and Six

我想分解它,以便每个标题值和src值得到一行,同时保持相同的id(在这种情况下为930。因此:

第1行:

930 | wpse_trac title=""Indian Summer" | src=""http://urlnamehere/bitstream/handle/2374.UC/731507 /Elliston_Marisa_Crawford_01-10-14_Track_01.mp3?sequence=7"

第2行

930 | [wpse_trac title=""The River"" src=""http://urlnamehere/bitstream/handle/2374.UC/731507/Elliston_Marisa_Crawford_01-10-14_Track_02.mp3?sequence=8

2 个答案:

答案 0 :(得分:1)

  1. 将文字放在单元格A1
  2. 转到Data标签,然后选择Text to Columns
  3. 选择Delimited,然后按Next
  4. 选中Other:并输入],然后按Next
  5. Destination中,选择A1以外的单元格,然后点击Finish
  6. 您会看到原始文本分为多个列。此时,请按照以下步骤操作:

    1. 按键盘上的Ctrl+H以打开替换文字对话框。 在Find what:中,输入" type*并点击Replace All
    2. 选择包含结果数据的所有单元格,然后复制它们 将它们粘贴为Transpose,将其粘贴到行而不是列中。
    3. 删除第一个和最后一个单元格(不需要)
    4. 通过您做的一些微小的触摸完成所需的任务。 ENJOY

答案 1 :(得分:0)

如果您的文字位于单元格A1中并按下公式,请尝试以下公式:

=MID($A$1,1,SEARCH(" ",$A$1)-1)&" | "&MID($A$1,SEARCH("£wpse_trac title",SUBSTITUTE($A$1,"wpse_trac title","£wpse_trac title",ROW(A1))),SEARCH("£http:",SUBSTITUTE($A$1,"http:","£http:",ROW(A1)))-SEARCH("£wpse_trac title",SUBSTITUTE($A$1,"wpse_trac title","£wpse_trac title",ROW(A1)))-8)&" | "&MID($A$1,SEARCH("£http:",SUBSTITUTE($A$1,"http:","£http:",ROW(A1)))-6,SEARCH(" ",$A$1,SEARCH("£sequence",SUBSTITUTE($A$1,"sequence","£sequence",ROW(A1))))+10-SEARCH("£http:",SUBSTITUTE($A$1,"http:","£http:",ROW(A1)))-6)

string substitute