Column to columns

Jaymond Flurrie

Well-known Member
Joined
Sep 22, 2008
Messages
919
Office Version
  1. 365
Platform
  1. Windows
Does someone here have a ready code (formula or VBA) that would share data from a column to several columns.

So what I'm _not_ looking for is a "Text to columns" functionality, I know how to use that.

What I'm looking for is that when I import data from a website (like bank statement), it shows up like this:

5.10.2021
Food from store
-23,78
5.10.2021
Electricity bill
-15,15
3.10.2021
Food from store
-16

and that's in exactly one column. I want to split that to three columns, so that it turns out like this:
5.10.2021 Food from store -23,78
5.10.2021 Electricity bill -15,15
3.10.2021 Food from store -16

So every third row is a date, every third row is a description and every third row is an amount.

So a more generic definition: Split data in a column into X columns

I'm sure there's ready made code for this, I just don't know what to search with in order to avoid the "use text to columns functionality"-answers.

Here's a start for it:

Assuming the data is in Column A, starting from row 1, to Column B formula to get the first column values:
=IF(MOD(ROW(A1)+2;3)=0;A1;"")
to Column C to get the second column values:
=IF(MOD(ROW(A1)+1;3)=0;A1;"")
and to Column D to get the third column values:
=IF(MOD(ROW(A1);3)=0;A1;"")

but this returns values to every row, with two of the columns being empty. So this is not ready, although it is a start.
 
Last edited:

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

16.0.14430.20154 32-bit
 
Upvote 0
That is the build not the actual version which will be either 2016, 2019 or 365. I suspect it's 365. Can you please confirm which?
 
Upvote 0
Thanks for that, how about
+Fluff 1.xlsm
ABCD
1abcabcdefxyz
2defabc1ddd1fff1
3xyz   
4abc1
5ddd1
6fff1
7
Lists
Cell Formulas
RangeFormula
B1:D3B1=IFERROR(INDEX($A$1:$A$6,(ROWS(B$1:B1)-1)*3+COLUMNS($B1:B1)),"")
 
Upvote 0
Solution
Works great and seems easy enough to expand to either more rows or even to more columns!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,821
Messages
6,121,759
Members
449,048
Latest member
excelknuckles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top