Excel - Split String from Cells

后端 未结 2 1339
你的背包
你的背包 2021-01-26 03:41

I have a large CSV with a couple of columns containing HTML over hundreds of rows. I need to separate certain parts into new columns. For example, a cell can contain:

相关标签:
2条回答
  • 2021-01-26 04:16

    To prevent super long formulas, may be easier to split formulas over two columns and hide the column if you want. For example, if you text is the A column, then put these formulas in the following cells: into B1:

    =RIGHT(A1,LEN(A1)-FIND("class=""title"">",A1)-13)
    

    into C1:

    =LEFT(B1,FIND("</div",B1)-1)
    

    into D1:

    =RIGHT(A1,LEN(A1)-FIND("class=""description"">",A1)-19)
    

    into E1:

    =LEFT(D1,FIND("</div",D1)-1)
    

    then copy\fill down.

    0 讨论(0)
  • 2021-01-26 04:27

    For the Description: (Output: This is a description)

    =REPLACE(REPLACE(REPLACE(F9,FIND("This is a title",F9,1),LEN("This is a title"),""),1,LEN(".some-class{property:value;}"),""),LEN(REPLACE(REPLACE(F9,FIND("Thisis a title",F9,1),LEN("This is a title"),""),1,LEN(".some-class{property:value;}"),"")),1,"")
    

    For the Title: (Output: This is a title)

    =REPLACE(REPLACE(REPLACE(F9,FIND("This is a description",F9,1),LEN("This is a description"),""),1,LEN(".some-class{property:value;}"),""),LEN(REPLACE(REPLACE(F9,FIND("This is a description",F9,1),LEN("This is a description"),""),1,LEN(".some-class{property:value;}"),"")),1,"")
    

    It is not very solution but you can consider changing the strings inside to formula to get your desired string. It can do (though time-consuming) if you still can't find the best solution.

    0 讨论(0)
提交回复
热议问题