lll
lll

Reputation: 1109

Excel: how to combine two columns with conditions

I have a short excel table like the following in each cell:

Estimate    Std. Error
-302.3000   40.6300
0.7594      0.1067
0.3180      0.0771
-0.7590     0.0689
-1.5620     0.0774
0.4388      0.0541
-0.3687     0.0619 
0.0229      0.0588
0.0002      0.0000
0.0000      0.0000

and I want to insert the second column value right beneath each of the value in the first column. Ideally, I want a result like the following:

-302.3000   
(40.6300)
0.7594
(0.1067)        
0.3180
(0.0771)        
-0.7590     
(0.0689)

I know this can be done manually, but I have seven tables like this. So I am looking for some more efficient way in excel. Would greatly appreciate any insight.

Upvotes: 0

Views: 120

Answers (1)

Scott Craner
Scott Craner

Reputation: 152450

This formula will do it:

=INDEX($A:$B,(ROW(1:1)-1)/2+2,MOD(ROW(1:1)-1,2)+1)

Put it in the first cell you want and drag down.

enter image description here

To put the () around every second number use add and IF() before and after:

=IF(MOD(ROW(1:1)-1,2),"(","") & INDEX($A:$B,(ROW(1:1)-1)/2+2,MOD(ROW(1:1)-1,2)+1) & IF(MOD(ROW(1:1)-1,2),")","")

enter image description here

Upvotes: 1

Related Questions