Convert Data from multiple Rows to one Row with corresponding Value in Columns

nguyentuson

New Member
Joined
Oct 18, 2023
Messages
5
Office Version
  1. 2019
Platform
  1. Windows
Hi everyone !

I'm writting an excel spreadsheet by VBA code for automatic Combinate of Loads in structure analysis job
and i do not know by the way which code for convert data from Multiple Rows in to One Corresponding Row (but data must be paste in corresponding Column in that Row)


Detail descripble like this
I have many Load Patterns in col L (it's sorted dymically by my code and transpoted to N1--->till the last Pattern)
then which corresponding Load Combination Name in Col M, ex 3-LRFD-ComB2_1 i have to lookup from Col A and recognize that it has 6 load participate Load Pattern located in col C (DEAD1, NX_DEAD1, FL-L1, NX_FL-L1, RL1 & NX_RL1)
i must copy Load Factor(1.2 1.2 0.75 0.75 0.5 0.5 ) located in col B and past again to Row 4 which 3-LRFD-ComB2_1 , but Load Factor was pasted to corresponding Load Pattern name in col N,O, Q,R,S,T )
and which cells was not relate to 3-LRFD-ComB2_1, the Load Factor =0.







Many thanks !
 

Attachments

  • screenshot_1697622510.png
    screenshot_1697622510.png
    53.1 KB · Views: 17

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Can you give us some data to work withusing the XL2bb tool , but power query will do the job and i know some of the people on here have previously posted instructions on this, did you try a search on the board
 
Upvote 0
i work on procedure about XL2BB tool, but i can not paste the value to the board.
 
Upvote 0
Select what youo want to copy and just paste in what it copies
1697639223230.png
 
Upvote 0
i've copied, it say everything is ok, but when i click paste to the board , nothing were pasted
 

Attachments

  • Capture2.PNG
    Capture2.PNG
    70.7 KB · Views: 8
Upvote 0
would you mind if copy my data to your spreadsheet and test it, many appreciate !


Name Factor Patterns DEAD1 NX_DEAD1 NY_DEAD1 FL-L1 NX_FL-L1 RL1 NX_RL1 NY_FL-L1 NY_RL1 RL2
1-LRFD-ComB1_1 1.4 DEAD1 DEAD1 1-LRFD-ComB1_1 1.4 1.4 0 0 0 0 0 0 0 0
1-LRFD-ComB1_1 1.4 NX_DEAD1 NX_DEAD1 2-LRF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.4DEAD1DEAD11-LRFD-ComB1_11.41.400000000
31-LRFD-ComB1_11.4NX_DEAD1NX_DEAD12-LRFD-ComB1_21.401.40000000
42-LRFD-ComB1_21.4DEAD1NY_DEAD13-LRFD-ComB2_11.21.200.750.750.50.5000
52-LRFD-ComB1_21.4NY_DEAD1FL-L14-LRFD-ComB2_2
63-LRFD-ComB2_11.2DEAD1NX_FL-L15-LRFD-ComB2_3
73-LRFD-ComB2_11.2NX_DEAD1RL16-LRFD-ComB2_4
83-LRFD-ComB2_10.75FL-L1NX_RL17-LRFD-ComB2_5
93-LRFD-ComB2_10.75NX_FL-L1NY_FL-L18-LRFD-ComB2_6
103-LRFD-ComB2_10.5RL1NY_RL19-LRFD-ComB2_7
113-LRFD-ComB2_10.5NX_RL1RL210-LRFD-ComB2_8
124-LRFD-ComB2_21.2DEAD1NX_RL211-LRFD-ComB2_9
134-LRFD-ComB2_21.2NY_DEAD1NY_RL212-LRFD-ComB2_10
144-LRFD-ComB2_20.75FL-L1CRane113-LRFD-ComB2_11
154-LRFD-ComB2_20.75NY_FL-L1NX_CRane114-LRFD-ComB2_12
164-LRFD-ComB2_20.5RL1NY_CRane115-LRFD-ComB3a_1
174-LRFD-ComB2_20.5NY_RL1W116-LRFD-ComB3a_2
185-LRFD-ComB2_31.2DEAD1W217-LRFD-ComB3a_3
195-LRFD-ComB2_31.2NX_DEAD1EQX18-LRFD-ComB3a_4
205-LRFD-ComB2_30.75FL-L119-LRFD-ComB3a_5
215-LRFD-ComB2_30.75NX_FL-L120-LRFD-ComB3a_6
225-LRFD-ComB2_30.5RL221-LRFD-ComB3a_7
Sheet2
 
Upvote 0
Power Query solution
Book1
ABCDEFGHIJKLMNO
1NameFactorPatternsNameDEAD1NX_DEAD1NY_DEAD1FL-L1NX_FL-L1RL1NX_RL1NY_FL-L1NY_RL1RL2
21-LRFD-ComB1_11.4DEAD11-LRFD-ComB1_11.41.400000000
31-LRFD-ComB1_11.4NX_DEAD12-LRFD-ComB1_21.401.40000000
42-LRFD-ComB1_21.4DEAD13-LRFD-ComB2_11.21.200.750.750.50.5000
52-LRFD-ComB1_21.4NY_DEAD14-LRFD-ComB2_21.201.20.7500.500.750.50
63-LRFD-ComB2_11.2DEAD15-LRFD-ComB2_31.21.200.750.7500000.5
73-LRFD-ComB2_11.2NX_DEAD1
83-LRFD-ComB2_10.75FL-L1
93-LRFD-ComB2_10.75NX_FL-L1
103-LRFD-ComB2_10.5RL1
113-LRFD-ComB2_10.5NX_RL1
124-LRFD-ComB2_21.2DEAD1
134-LRFD-ComB2_21.2NY_DEAD1
144-LRFD-ComB2_20.75FL-L1
154-LRFD-ComB2_20.75NY_FL-L1
164-LRFD-ComB2_20.5RL1
174-LRFD-ComB2_20.5NY_RL1
185-LRFD-ComB2_31.2DEAD1
195-LRFD-ComB2_31.2NX_DEAD1
205-LRFD-ComB2_30.75FL-L1
215-LRFD-ComB2_30.75NX_FL-L1
225-LRFD-ComB2_30.5RL2
Sheet2


Here is the code
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Factor", type number}, {"Patterns", type text}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Patterns]), "Patterns", "Factor", List.Sum),
    #"Replaced Value" = Table.ReplaceValue(#"Pivoted Column",null,0,Replacer.ReplaceValue,{"DEAD1", "NX_DEAD1", "NY_DEAD1", "FL-L1", "NX_FL-L1", "RL1", "NX_RL1", "NY_FL-L1", "NY_RL1", "RL2"})
in
    #"Replaced Value"
 
Upvote 0
Appreciate with your solution!

Would you mind sharing me your sheet with solution, i do not know how to use your code ( i'm a beginner in VBA , i have just write code by my selft for one week)
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

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