Transfer Multiple Rows Data in Single Row Excluding Blanks

Dheepak

Board Regular
Joined
Aug 25, 2013
Messages
64
Hi All,

I have the data of Product in Row A and its price in row B. Similarly Product in Row C and its price in row D. in Total having 3 list of products and prices. Maximum 10 entries user can enter in each row. I want all the products from those 3 rows in single row G and its price in H without including the blanks. Here is the expectation .

A
B
C
D
E
F
G
H
Product A
Price
Product A1
Price
Product A2
Price
Product A
Price of Product A
Product B
Price
Product B1
Price
Product B
Price of Product A
Product C1
Price
Product A1
Price of Product A1
Product B1
Price of Product B1
Product C1
Price of Product C1
Product A2
Price of Product A2

<tbody>
</tbody>

Can any one please help on this.
 

Some videos you may like

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

MickG

MrExcel MVP
Joined
Jan 9, 2008
Messages
14,841
For data starting in "A1", try this for results starting "G1".
Code:
[COLOR="Navy"]Sub[/COLOR] MG24Jul46
[COLOR="Navy"]Dim[/COLOR] ray [COLOR="Navy"]As[/COLOR] Variant, n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] c [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] Ac [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
ray = Range("A1").CurrentRegion.Resize(, 6)
ReDim nray(1 To UBound(ray, 1) * UBound(ray, 2), 1 To 2)

[COLOR="Navy"]For[/COLOR] Ac = 1 To UBound(ray, 2) [COLOR="Navy"]Step[/COLOR] 2
    [COLOR="Navy"]For[/COLOR] n = 1 To UBound(ray, 1)
        [COLOR="Navy"]If[/COLOR] Not IsEmpty(ray(n, Ac)) [COLOR="Navy"]Then[/COLOR]
            c = c + 1
            nray(c, 1) = ray(n, Ac)
            nray(c, 2) = ray(n, Ac + 1)
        [COLOR="Navy"]End[/COLOR] If
    [COLOR="Navy"]Next[/COLOR] n
[COLOR="Navy"]Next[/COLOR] Ac
Range("G1").Resize(c, 2).Value = nray
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 

Watch MrExcel Video

Forum statistics

Threads
1,122,737
Messages
5,597,826
Members
414,180
Latest member
Sir Khaya

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
Top