Would have been nice to mention that this was for Google Sheets
BEFORE I spend a half hour on
TWO SOLUTIONS!
Do a google search for "Google Sheets Boards".
This was particularly difficult. First option is to use Power Query. Here's the code:
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
ReplacedLeftCurly = Table.ReplaceValue(Source,"{","",Replacer.ReplaceText,{"Column1"}),
ReplacedRightCurly = Table.ReplaceValue(ReplacedLeftCurly,"}","",Replacer.ReplaceText,{"Column1"}),
ReplacedDoubleQuotes = Table.ReplaceValue(ReplacedRightCurly,"""","",Replacer.ReplaceText,{"Column1"}),
SplitColumnByColon = Table.SplitColumn(ReplacedDoubleQuotes, "Column1", Splitter.SplitTextByDelimiter(":", QuoteStyle.Csv), {"Column1.1", "Column1.2", "Column1.3", "Column1.4", "Column1.5", "Column1.6", "Column1.7", "Column1.8"}),
TransposedTable = Table.Transpose(SplitColumnByColon),
SplitColumnByComma = Table.ExpandListColumn(Table.TransformColumns(Table.TransformColumnTypes(TransposedTable, {{"Column1", type text}}, "en-US"), {{"Column1", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Column1"),
TransposedTable1 = Table.Transpose(SplitColumnByComma),
ChangedType = Table.TransformColumnTypes(TransposedTable1,{{"Column1", type text}, {"Column2", type number}, {"Column3", type text}, {"Column4", type number}, {"Column5", type text}, {"Column6", type number}, {"Column7", type text}, {"Column8", Int64.Type}, {"Column9", type text}, {"Column10", type number}, {"Column11", type text}, {"Column12", type number}, {"Column13", type text}, {"Column14", type number}})
in
ChangedType
The second option is using Excel (MS 365) functions:
| | | | | | | | | | | | | | |
| {"CAD":1.404,"EUR":0.925,"MXN":25.103,"USD":1,"SGD":1.433,"AUD":1.649,"GBP":0.813} | | | | | | | | | | | | | |
Formula in B2: =SUBSTITUTE(B1,"{","") | "CAD":1.404,"EUR":0.925,"MXN":25.103,"USD":1,"SGD":1.433,"AUD":1.649,"GBP":0.813} | | | | | | | | | | | | | |
Formula in B3: =SUBSTITUTE(B2,"}","") | "CAD":1.404,"EUR":0.925,"MXN":25.103,"USD":1,"SGD":1.433,"AUD":1.649,"GBP":0.813 | | | | | | | | | | | | | |
Formula in B4: =SUBSTITUTE(B3,"""","") | CAD:1.404,EUR:0.925,MXN:25.103,USD:1,SGD:1.433,AUD:1.649,GBP:0.813 | | | | | | | | | | | | | |
Formula in B5: =TEXTJOIN("~",,SUBSTITUTE(TEXTSPLIT(B4,",",,,,"~"),":","~")) | CAD~1.404~EUR~0.925~MXN~25.103~USD~1~SGD~1.433~AUD~1.649~GBP~0.813 | | | | | | | | | | | | | |
Formula in B6: =TEXTSPLIT(B5,"~") | CAD | 1.404 | EUR | 0.925 | MXN | 25.103 | USD | 1 | SGD | 1.433 | AUD | 1.649 | GBP | 0.813 |
|
---|
Hope that helps anyone that comes across this. Maybe it will give you some idea of how to proceed using Sheets.
And yes, all of those Excel Formulas could be rolled into a single cell or LAMBDA, especially if this is an ongoing thing.