How to automatically split one row into different

2019-08-09 02:46发布

问题:

I'm trying to split one row in Google Sheets into different rows depending on its content. Here's an example:

Name    | Ticker | Categories
Bitcoin | BTC    | currency; store-of-value; trust layer; smart contracts; cross-industry
Ripple  | XRP    | currency; cross-industry

Into:

Name    | Ticker | Categories
Bitcoin | BTC    | currency 
Bitcoin | BTC    | store-of-value 
Bitcoin | BTC    | trust layer
Bitcoin | BTC    | smart contracts 
Bitcoin | BTC    | cross industry
Ripple  | XRP    | currency
Ripple  | XRP    | cross-industry

How can I do this using a script or any other tools?

回答1:

=ARRAYFORMULA(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(IFERROR(SPLIT(C1:C, ";"))<>"", "♥"&A1:A&"♦"&B1:B&"♦"&
 IFERROR(SPLIT(C1:C, ";")), )),,999^99)),,999^99), "♥")), "♦")))