メインコンテンツへスキップ

Excelでカンマ区切りの値を行または列に分割するにはどうすればよいですか?

場合によっては、選択したセルのコンマ区切り値を行または列に分割する必要があります。 ここでは、この問題を解決するためのXNUMXつの方法を詳しく紹介します。

Text to Columns関数を使用して、コンマ区切り値を列に分割します
カンマ区切りの値をVBAコードで行に分割する
Kutools for Excelを使用して、カンマ区切りの値を行または列にすばやく分割します


Text to Columns関数を使用して、コンマ区切り値を列に分割します

Text to Columns関数を適用して、選択したセルのコンマ区切り値を列に分割できます。 次のようにしてください。

1.値を列に分割するセルの範囲を選択し、[ 且つ > テキストから列へ。 スクリーンショットを参照してください:

2.最初に テキストを列ウィザードに変換する ダイアログボックスで 区切り文字付き オプションをクリックしてから、 Next

3番目に テキストを列ウィザードに変換する ダイアログボックスで、チェックするだけ コンマ 内箱 デリミタ セクションを開き、 Next

4.最後に テキストを列ウィザードに変換する ダイアログボックスで、分割値を見つけるためのセルを選択します。 開催場所 ボックスをクリックし、最後に 終了 ボタン。 スクリーンショットを参照してください:

これで、以下のスクリーンショットに示すように、コンマで区切られた選択したセルのすべての値が異なる列に分割されます。

通常、 列へのテキスト 機能はセルを別々の列に分割するだけです。セルを行に分割したい場合、どうすればよいですか?
ここで Kutools for Excel's 分割セル ユーティリティを使用すると、セルをスペース、コンマ、改行、その他の区切り文字、または特定の幅で、分離された行だけでなくExcelの列にすばやく分割できます。 Excel用のKutoolsを今すぐダウンロードしてください! (30 日間の無料トレイル)


カンマ区切りの値をVBAコードで行に分割する

カンマ区切りの値を行に分割するには、次のVBAコードを適用できます。

1。 プレス 他の + F11 キーを同時に開いて アプリケーション向け Microsoft Visual Basic 窓。

2。 の中に アプリケーション向け Microsoft Visual Basic ウィンドウ、クリック インセット > モジュール。 次に、以下のVBAコードをコピーしてモジュールウィンドウに貼り付けます。

VBAコード:カンマ区切りの値を行に分割

Sub SplitAll()
	Dim xRg As Range
	Dim xRg1 As Range
	Dim xCell As Range
	Dim I As Long
	Dim xAddress As String
	Dim xUpdate As Boolean
	Dim xRet As Variant
	On Error Resume Next
	xAddress = Application.ActiveWindow.RangeSelection.Address
	Set xRg  = Application.InputBox("Please select a range", "Kutools for Excel", xAddress, , , , , 8)
	Set xRg  = Application.Intersect(xRg, xRg.Worksheet.UsedRange)
	If xRg Is Nothing Then Exit Sub
		If xRg.Columns.Count > 1 Then
			MsgBox "You can't select multiple columns", , "Kutools for Excel"
			Exit Sub
			End If
			Set xRg1 = Application.InputBox("Split to (single cell):", "Kutools for Excel", , , , , , 8)
			Set xRg1 = xRg1.Range("A1")
			If xRg1 Is Nothing Then Exit Sub
				xUpdate = Application.ScreenUpdating
				Application.ScreenUpdating = False
				For Each xCell In xRg
					xRet = Split(xCell.Value, ",")
					xRg1.Worksheet.Range(xRg1.Offset(I, 0), xRg1.Offset(I + UBound(xRet, 1), 0)) = Application.WorksheetFunction.Transpose(xRet)
					I = I + UBound(xRet, 1) + 1
				Next
				Application.ScreenUpdating = xUpdate
			End Sub

3。 プレス F5 コードを実行するためのキー。 ポップアップで Kutools for Excel ダイアログボックスで、分割するセルを選択し、[ OK

4番目のポップアップで Kutools for Excel ダイアログボックスで、分割値を見つけるためのセルを選択し、をクリックします OK.

次に、以下のスクリーンショットに示すように、選択したセルのカンマ区切り値が行に分割されていることがわかります。


Kutools for Excelを使用して、カンマ区切りの値を行または列にすばやく分割します

The 分割セル の有用性 Kutools for Excel カンマ区切りの値を行または列に簡単に分割するのに役立ちます。

1.分割する必要のあるセルを選択し、[ クツール > マージ&スプリット > 分割セル。 スクリーンショットを参照してください:

2。 の中に 分割セル ダイアログボックスで 行に分割 or 列に分割 セクションに 必要に応じてセクション。 そして、 区切り文字を指定します セクションで、 その他 オプションで、テキストボックスにカンマ記号を入力し、[ OK ボタン。 スクリーンショットを参照してください:

3.次に、別のプロンプトボックスが表示され、結果を出力するセルを選択するように通知されます。スクリーンショットを参照してください。

4。 クリック OK ボタンをクリックすると、以下のスクリーンショットのように結果を確認できます。

列に分割

行に分割

  このユーティリティの無料トライアル(30日)が必要な場合は、 クリックしてダウンロードしてください、次に、上記の手順に従って操作を適用します。


デモ:Kutools for Excelを使用して、カンマ区切りの値を行または列にすばやく分割します

最高のオフィス生産性向上ツール

🤖 Kutools AI アシスタント: 以下に基づいてデータ分析に革命をもたらします。 インテリジェントな実行   |  コードを生成  |  カスタム数式の作成  |  データを分析してグラフを生成する  |  Kutools関数を呼び出す...
人気の機能: 重複を検索、強調表示、または識別する   |  空白行を削除する   |  データを失わずに列またはセルを結合する   |   数式なしのラウンド ...
スーパールックアップ: 複数の基準の VLookup    複数の値の VLookup  |   複数のシートにわたる VLookup   |   ファジールックアップ ....
詳細ドロップダウン リスト: ドロップダウンリストを素早く作成する   |  依存関係のドロップダウン リスト   |  複数選択のドロップダウンリスト ....
列マネージャー: 特定の数の列を追加する  |  列の移動  |  Toggle 非表示列の表示ステータス  |  範囲と列の比較 ...
注目の機能: グリッドフォーカス   |  デザインビュー   |   ビッグフォーミュラバー    ワークブックとシートマネージャー   |  リソースライブラリ (自動テキスト)   |  日付ピッカー   |  ワークシートを組み合わせる   |  セルの暗号化/復号化    リストごとにメールを送信する   |  スーパーフィルター   |   特殊フィルター (太字/斜体/取り消し線をフィルター...) ...
上位 15 のツールセット12 テキスト ツール (テキストを追加, 文字を削除する、...)   |   50+ チャート 種類 (ガントチャート、...)   |   40+ 実用的 (誕生日に基づいて年齢を計算する、...)   |   19 挿入 ツール (QRコードを挿入, パスから画像を挿入、...)   |   12 変換 ツール (数字から言葉へ, 通貨の換算、...)   |   7 マージ&スプリット ツール (高度な結合行, 分割セル、...)   |   ... もっと

Kutools for Excel で Excel スキルを強化し、これまでにない効率を体験してください。 Kutools for Excelは、生産性を向上させ、時間を節約するための300以上の高度な機能を提供します。  最も必要な機能を入手するにはここをクリックしてください...

説明


Officeタブは、タブ付きのインターフェイスをOfficeにもたらし、作​​業をはるかに簡単にします

  • Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
  • 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
  • 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
Comments (11)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
A jak zmienić kod żeby nie pytał o ustawienie się w A1 i potem aby wynik był np też od A1 w dół
This comment was minimized by the moderator on the site
Hi Bartek,
You mean don't want to pop up the second dialog to select the target cell, and want to specify the target cell in the code directly?
If so, you need to change the following lines.
For example, you need to start outputting results from B1 and automatically fill down.
Please change this line:
Set xRg1 = Application.InputBox("Split to (single cell):", "Kutools for Excel", , , , , , 8)
to
Set xRg1 = Application.Range("B2")
And then remove the next line:
Set xRg1 = xRg1.Range("A1")
This comment was minimized by the moderator on the site
i still cant upload my csv into 365
This comment was minimized by the moderator on the site
Go to excel file Data option -> text to column->delimited -> Done
it will spit comma separated value into individual column
example
id name add
1 Ratnesh myAdd
2,Yog,myAdd
we will apply in the 2nd record it will split record like 1st records,
Thanks,
Ratnesh Sahu
This comment was minimized by the moderator on the site
Go to excel file Data option -> text to column->delimited -> Done
it will spit comma separated value into individual column
example

id name add

1 Ratnesh myAdd

2,Yog,myAdd


we will apply in the 2nd record it will split record like 1st records,


Thanks,
Ratnesh Sahu
This comment was minimized by the moderator on the site
Thanks it helped :)
This comment was minimized by the moderator on the site
This is amazing, thanks for making it free and easy to use!
This comment was minimized by the moderator on the site
Thank you!
This comment was minimized by the moderator on the site
Alternately for separating into rows, use the text to column steps and then copy & paste ->transpose to turn the columns into rows.
This comment was minimized by the moderator on the site
Thanks Jake! This is what I was looking for. :)
This comment was minimized by the moderator on the site
Good one, the utility help me a lot. Thanks for that... :)
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations