Rows to Colomns ( Formula )

Please_H

Board Regular
Joined
Apr 16, 2017
Messages
181
Office Version
  1. 2019
Platform
  1. Windows
Hello Everyone,

Hope everyone of you all out there are safe from Covid19.

I have some information typed from Cell A1 to Cell A100
How do I get them across B1, (C1 to F1 - Blank) G1, (H1 to K1 - Blank) so on?

wip Excel Sheet.xlsm
ABCDEFGHIJKL
1ABCABCDEFGHI
2DEF
3GHI
4JKL
5MNO
6PQR
7STU
8VWX
Sheet5


Thanks to all of you...
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Here is one way.

Place this formula in B1 and copy across row 1 as far as you need:
=IF(MOD(COLUMN(),5)=2,OFFSET(B1,INT(COLUMN()/5),1-COLUMN()),"")
 
Upvote 0
Here is one way.

Place this formula in B1 and copy across row 1 as far as you need:
=IF(MOD(COLUMN(),5)=2,OFFSET(B1,INT(COLUMN()/5),1-COLUMN()),"")

Wow...
That was one Heaven of a Solution Bro...
Thanks a lot.

Can you explain me how do I apply and understand this formula?
Thanks a lot....
 
Upvote 0
Here is one way.

Place this formula in B1 and copy across row 1 as far as you need:
=IF(MOD(COLUMN(),5)=2,OFFSET(B1,INT(COLUMN()/5),1-COLUMN()),"")

And How do we apply if the Colomn A is in a different Sheet in the same workbook?
 
Upvote 0
And How do we apply if the Colomn A is in a different Sheet in the same workbook?
Just add the sheet reference in front of the cell in the formula, i.e.
=IF(MOD(COLUMN(),5)=2,OFFSET(Sheet1!B1,INT(COLUMN()/5),1-COLUMN()),"")

To understand the formula, it is important to understand the various functions used it in.
The COLUMN() function simply returns the column that the formula is placed in. So, if you typed =COLUMN() in any cell, copy it across a row and watch what it returns,
The MOD function returns the remainder when one value is divided by another.
The INT function returns the integer value when one number is divided by another (drops the decimal part).
With OFFSET function, you give it a starting cell address, then tell it how many rows and columns to move from it.

You want to put these values in columns 2, 7, 12, 17, 22, etc. So it is every 5th column, starting with column 2.
So, in our IF function, we are saying that if the remainder of the column number divided by 5 is 2, then return the value of the next formula in that cell, else return nothing ("").

Next, with the OFFSET function, I tell it to start from the cell the formula is in (B1), and then to determine how many rows/columns to move from there:
Rows: Divide column number by 5, and drop the decimal portion. So, 2/5 would return 0; 7/5 would return 1; 12/5 would return 2, etc.
Columns: Subtract the column number from 1. So 1-2=-1; 1-7=-6;1-12=-11 (note the negative number means we move to the left ,and not the right).

So, if you do the math on the first few:
B1: OFFSET(B1,0,-1) means that starting from cell B1, we move 0 rows and 1 column to the left, which is cell A1. So we are returning the value from cell A1 in cell B1.
G1: OFFSET(G1,1,-6) means that starting from cell G1, we move 1 row down and 6 columns to the left, which is cell A2. So we are returning the value from cell A2 in cell G1.
L1: OFFSET(G1,2,-11) means that starting from cell G1, we move 2 row down and 11 columns to the left, which is cell A3. So we are returning the value from cell A3 in cell L1.
etc.

I hope that clarifies things for you. The trick to figuring out complicated formulas like this is to break it down into smaller parts, and figure out what each part is doing.
 
Upvote 0
What are you guys seriously having for Lunch? VBA
:ROFLMAO: :ROFLMAO: :ROFLMAO:

Man you are Genius...
I have been trying to figure this out for the past 1 hour or so and one word... "AMAZING"

Thank you very very much.
Stay safe from Covid19 Bro.
Tc.
 
Upvote 0
Thanks for the kind words.
Glad it helped!:)
 
Upvote 0
Thanks for the kind words.
Glad it helped!:)

You are most Welcome Bro, you've really lived by your word > "Give a man a fish, feed him for a day. Teach a man to fish, feed him for life!"
May God Almighty Guide you for the Best at all times.
See you around again.
Bye.
 
Upvote 0
Also you can use the following

010-MSPTDA-CustomFunction-MovingAnnualTotals-Excel.xlsx
ABCDEFGHIJKLMNOPQR
1Helper ColumnRangeABCDEFGHI
21ABC
32DEF
43GHI
54JKL
65MNO
76PQR
Sheet3
Cell Formulas
RangeFormula
C1:KJ1C1=TRANSPOSE(IFNA(VLOOKUP(IFNA(MATCH(ROW(1:294),(ROW(1:5)-ROW(1:1))*6+1,0),""),A:B,2,0),""))
Dynamic array formulas.
 
Upvote 0
Also you can use the following

010-MSPTDA-CustomFunction-MovingAnnualTotals-Excel.xlsx
ABCDEFGHIJKLMNOPQR
1Helper ColumnRangeABCDEFGHI
21ABC
32DEF
43GHI
54JKL
65MNO
76PQR
Sheet3
Cell Formulas
RangeFormula
C1:KJ1C1=TRANSPOSE(IFNA(VLOOKUP(IFNA(MATCH(ROW(1:294),(ROW(1:5)-ROW(1:1))*6+1,0),""),A:B,2,0),""))
Dynamic array formulas.


Thanks a lot for your feedback Bro...
I know merged cells are a bad practice and Array formulas which are entered as CTRL+Shift+Enter doesn't work on them,
Would this work on Merged Cells by any means?
Even If yes/No,
Could you be kind enough to explain how it works?
Thanks a lot bro.
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,625
Members
449,093
Latest member
catterz66

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