Combining two columns in one(not concut)

datastudent

Board Regular
Joined
Sep 7, 2021
Messages
92
Office Version
  1. 365
Platform
  1. Windows
Hi,

Please help me combine two set of data in one column without using pivot.

The first table is the data that I have and the second table is how I want it to be. I would like a formula that would give me the result for both tables please like if I have table2 how do I get table1 and vice versa. Thank you!

Template_v1.xlsm
ABCDEFG
1NameFixedMobileNameServiceCost
2AAA123122AAAFixed123
3BBB234345AAAMobile122
4BBBFixed234
5BBBMobile345
Sheet7
 
Try:
Book2
ABCDEFG
1NameFixedMobileNameServiceCost
2AAA123122AAAFixed123
3BBB234345AAAMobile122
4BBBFixed234
5BBBMobile345
Sheet5
Cell Formulas
RangeFormula
E2:G5E2=DROP(REDUCE("",TOCOL(A2:A3&"|"&B1:C1&"|"&B2:C3),LAMBDA(x,y,VSTACK(x,TEXTSPLIT(y,"|")))),1)
Dynamic array formulas.
 
Upvote 0
Another option
Excel Formula:
=LET(d,B2:C3,HSTACK(TOCOL(IF(d<>"",A2:A3,1/0),2),TOCOL(IF(d<>"",B1:C1,1/0),2),TOCOL(d,1)))
 
Upvote 0
Solution
Another option

25 01 25.xlsm
ABCDEFG
1NameFixedMobileNameServiceCost
2AAA123122AAAFixed123
3BBB234345AAAMobile122
4BBBFixed234
5BBBMobile345
2 to 1
Cell Formulas
RangeFormula
E2:G5E2=TEXTSPLIT(TEXTJOIN(":",,A2:A3&"|"&B1:C1&"|"&B2:C3),"|",":")
Dynamic array formulas.


The above formula returns text values in column G (as does the suggestion in post2). If those values need to be numerical then

25 01 25.xlsm
ABCDEFG
1NameFixedMobileNameServiceCost
2AAA123122AAAFixed123
3BBB234345AAAMobile122
4BBBFixed234
5BBBMobile345
2 to 1 (2)
Cell Formulas
RangeFormula
E2:G5E2=LET(t,TEXTSPLIT(TEXTJOIN(":",,A2:A3&"|"&B1:C1&"|"&B2:C3),"|",":"),IFERROR(--t,t))
Dynamic array formulas.



.. both tables ... like if I have table2 how do I get table1

25 01 25.xlsm
ABCDEFG
1NameFixedMobileNameServiceCost
2AAA123122AAAFixed123
3BBB234345AAAMobile122
4BBBFixed234
5BBBMobile345
1 to 2
Cell Formulas
RangeFormula
A2:C3A2=HSTACK(UNIQUE(E2:E5),WRAPROWS(G2:G5,2))
Dynamic array formulas.
 
Upvote 0
TEXTJOIN method has character limitation so I stopped suggesting it.
 
Upvote 0
and yet one more option with power query. Unpivot your data

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Name"}, "Attribute", "Value")
in
    #"Unpivoted Other Columns"
 
Upvote 0
Another option

25 01 25.xlsm
ABCDEFG
1NameFixedMobileNameServiceCost
2AAA123122AAAFixed123
3BBB234345AAAMobile122
4BBBFixed234
5BBBMobile345
2 to 1
Cell Formulas
RangeFormula
E2:G5E2=TEXTSPLIT(TEXTJOIN(":",,A2:A3&"|"&B1:C1&"|"&B2:C3),"|",":")
Dynamic array formulas.


The above formula returns text values in column G (as does the suggestion in post2). If those values need to be numerical then

25 01 25.xlsm
ABCDEFG
1NameFixedMobileNameServiceCost
2AAA123122AAAFixed123
3BBB234345AAAMobile122
4BBBFixed234
5BBBMobile345
2 to 1 (2)
Cell Formulas
RangeFormula
E2:G5E2=LET(t,TEXTSPLIT(TEXTJOIN(":",,A2:A3&"|"&B1:C1&"|"&B2:C3),"|",":"),IFERROR(--t,t))
Dynamic array formulas.





25 01 25.xlsm
ABCDEFG
1NameFixedMobileNameServiceCost
2AAA123122AAAFixed123
3BBB234345AAAMobile122
4BBBFixed234
5BBBMobile345
1 to 2
Cell Formulas
RangeFormula
A2:C3A2=HSTACK(UNIQUE(E2:E5),WRAPROWS(G2:G5,2))
Dynamic array formulas.
Thank you for your response on my second question. But it seems like it doesn't work on the data that I have. Hope you can still help me.

This is how my actual data looks like.
Template_v1.xlsm
ABCD
1CountryService PlanOrigin typeOUT FIX/OUT MOB
2AUSTRALIAFixedNational0.0116
3AUSTRALIAFixedNational0.0116
4AUSTRALIAFixedNational0.0116
5AUSTRALIAFixedNational0.0116
6AUSTRALIAMobileNational0.0306
7AUSTRALIAMobileNational0.0306
8AUSTRIAFixedNational0.0082
9AUSTRIAFixedNational0.0082
10AUSTRIAMobileNational0.0092
VoxOut
 
Upvote 0
What is your expected outcome?
 
Upvote 0
I want to put Fixed ang Mobile in a separate column for each country.

This is the expected outcome.
Template_v1.xlsm
LMNO
1CountryOrigin TypeFixedMobile
2AUSTRALIANational0.01160.0306
3AUSTRIANational0.00820.0092
VoxOut
 
Upvote 0
Ok, how about
Fluff.xlsm
ABCDEFGHI
1CountryService PlanOrigin typeOUT FIX/OUT MOB
2AUSTRALIAFixedNational0.0116 FixedMobile
3AUSTRALIAFixedNational0.0116AUSTRALIANational0.01160.0306
4AUSTRALIAFixedNational0.0116AUSTRIANational0.00820.0092
5AUSTRALIAFixedNational0.0116
6AUSTRALIAMobileNational0.0306
7AUSTRALIAMobileNational0.0306
8AUSTRIAFixedNational0.0082
9AUSTRIAFixedNational0.0082
10AUSTRIAMobileNational0.0092
11
Data
Cell Formulas
RangeFormula
F2:I4F2=PIVOTBY(CHOOSECOLS(A2:C100,1,3),B2:B100,D2:D100,MAX,0,0,,0,,A2:A100<>"")
Dynamic array formulas.
 
Upvote 0

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