[英]how to extract a text from a string excel formula not working
讓我們假設:A2 包含您的字符串,A3 包含下一個字符串等。
然后
b1 包含字符串:id
e1 包含字符串:brand
h1 包含字符串:price
k1 包含字符串:release
n1 包含字符串:名稱
r1 包含字符串:類型
單元格 b2 包含:=SEARCH(B$1; $A2)+LENGTH(B$1)+3
單元格 c2 包含:=SEARCH(""""; $A2; B2)
單元格 d2 包含:=MID($A2;B2;C2-B2)
單元格 e2 包含:=SEARCH(E$1; $A2)+LENGTH(E$1)+3
單元格 f2 包含:=SEARCH("""";$A2;E2)
單元格 g2 包含:=MID($A2;E2;F2-E2)
等等 。 . .
您也可以使用 Excel 2010+ 中的Power Query
執行此操作
json
Data/Get&Transform/From Table/Range
將工作表范圍加載到 PQ添加自定義列並將其命名為json
:
Formula: =Json.Document([Column1])
添加另一個自定義列
Formula: =Table.FromRecords({[json]})
M碼
//you may need to change the table name in the second line of code
let
Source = Excel.CurrentWorkbook(){[Name="Table12"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "json", each Json.Document([Column1])),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Column1"}),
#"Added Custom1" = Table.AddColumn(#"Removed Columns", "Custom", each Table.FromRecords({[json]})),
#"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom1", "Custom", {"id", "brand", "price", "release", "name", "type"}, {"id", "brand", "price", "release", "name", "type"}),
#"Removed Columns1" = Table.RemoveColumns(#"Expanded Custom",{"json"})
in
#"Removed Columns1"
請注意,列將正確匹配,並且在 PQ 中,您將能夠設置所需的順序
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.