Rearrange Data Question

DevonH

New Member
Joined
Jul 3, 2016
Messages
5
Office Version
  1. 2010
Platform
  1. Windows
I am wondering what the best and easiest method is to rearrange data into a better format/table. For example, when I copy and paste data from a webpage, it gives the following format:


31-Dec-21
Interest Deposit
$6
$7
2-Dec-21
Mobile Deposit
$5
$4
30-Nov-21
Interest Deposit
$3
$2
22-Nov-21
Mobile Deposit
$1
$.01



But instead I would like to rearrange it in the following format:

31-Dec-21​
Interest Deposit
$6​
$7​
2-Dec-21​
Mobile Deposit
$5​
$4​
30-Nov-21​
Interest Deposit
$3​
$2​
22-Nov-21​
Mobile Deposit
$1​
$.01​


Thank you!
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
The data should start in cell A2.
Put the formula in C2 and copy to the right and down:

varios 31ene2022.xlsm
ABCDEF
1
231-Dec-2131-Dec-21Interest Deposit$6.00$7.00
3Interest Deposit2-Dec-21Mobile Deposit$5.00$4.00
4$6.0030-nov-21Interest Deposit$3.00$2.00
5$7.0022-nov-21Mobile Deposit$1.00$0.01
62-Dec-21
7Mobile Deposit
8$5.00
9$4.00
1030-nov-21
11Interest Deposit
12$3.00
13$2.00
1422-nov-21
15Mobile Deposit
16$1.00
17$0.01
Hoja3
Cell Formulas
RangeFormula
C2:F5C2=OFFSET($A2,(COLUMNS($B1:B1)-1)+((ROWS(B$1:B1)-1)*3),0)
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
 
Upvote 0
An alternative solution is with Power Query
Book1
ABCDE
1Column1Date2DepositAmount
231-Dec-2112/2/2021Interest Deposit6
3Interest Deposit12/2/2021Interest Deposit7
4$611/30/2021Mobile Deposit5
5$711/30/2021Mobile Deposit4
62-Dec-2111/22/2021Interest Deposit3
7Mobile Deposit11/22/2021Interest Deposit2
8$511/22/2021Mobile Deposit1
9$411/22/2021Mobile Deposit0.01
1030-Nov-21
11Interest Deposit
12$3
13$2
1422-Nov-21
15Mobile Deposit
16$1
17$0.01
Sheet1


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Added Custom" = Table.AddColumn(#"Promoted Headers", "Deposit", each if Text.Contains([#"31-Dec-21"],"Deposit") then [#"31-Dec-21"] else null),
    #"Replaced Errors" = Table.ReplaceErrorValues(#"Added Custom", {{"Deposit", null}}),
    #"Filled Down" = Table.FillDown(#"Replaced Errors",{"Deposit"}),
    #"Added Custom1" = Table.AddColumn(#"Filled Down", "Date", each if (try DateTime.ToText([#"31-Dec-21"],"yyyy-mm-dd") otherwise "No") = "No" then "No" else "IsDate"),
    #"Added Custom2" = Table.AddColumn(#"Added Custom1", "Date2", each if([Date] = "IsDate") then [#"31-Dec-21"] else null),
    #"Filled Up" = Table.FillUp(#"Added Custom2",{"Date2"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Filled Up",{{"Date2", type date}}),
    #"Filled Down1" = Table.FillDown(#"Changed Type",{"Date2"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Down1", each ([Date] = "No")),
    #"Added Custom3" = Table.AddColumn(#"Filtered Rows", "Amount", each try Number.From([#"31-Dec-21"]) is number otherwise false),
    #"Filtered Rows1" = Table.SelectRows(#"Added Custom3", each ([Amount] = true)),
    #"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows1",{"31-Dec-21", "Deposit", "Date2"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Removed Other Columns",{"Date2", "Deposit", "31-Dec-21"}),
    #"Renamed Columns" = Table.RenameColumns(#"Reordered Columns",{{"31-Dec-21", "Amount"}})
in
    #"Renamed Columns"
 
Upvote 0

Forum statistics

Threads
1,215,026
Messages
6,122,743
Members
449,094
Latest member
dsharae57

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