Normalization in excel

chethan av

New Member
Joined
Feb 24, 2020
Messages
9
Office Version
  1. 2007
Platform
  1. Windows
Hi guys
I want to build VBA code for normalization

if the data is populated in excel like this( 4 columns)

a h o v
b i p w
c j q x
d k r y
e l s z
f m t a
g n u b



i need to rearrange the data like given below

a h a h
b i b i
c j c j
d k d k
e l e l
f m f m
g n g n
o v o v
p w p w
q x q x
r y r y
s z s z
t a t a
u b u b

Please give a solution guys
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Welcome. Try this macro:
VBA Code:
Option Explicit

Sub Shifter()


    Dim LastRow As Long
    Dim Rw As Long
    LastRow = Range("A65536").End(xlUp).Row
    For Rw = 1 To LastRow
        Cells(LastRow + Rw, 1) = Cells(Rw, 3)
        Cells(LastRow + Rw, 2) = Cells(Rw, 4)
        Cells(LastRow + Rw, 3) = Cells(Rw, 3)
        Cells(LastRow + Rw, 4) = Cells(Rw, 4)
        Cells(Rw, 3) = Cells(Rw, 1)
        Cells(Rw, 4) = Cells(Rw, 2)

    Next Rw
End Sub
 
Upvote 0
Welcome. Try this macro:
VBA Code:
Option Explicit

Sub Shifter()


    Dim LastRow As Long
    Dim Rw As Long
    LastRow = Range("A65536").End(xlUp).Row
    For Rw = 1 To LastRow
        Cells(LastRow + Rw, 1) = Cells(Rw, 3)
        Cells(LastRow + Rw, 2) = Cells(Rw, 4)
        Cells(LastRow + Rw, 3) = Cells(Rw, 3)
        Cells(LastRow + Rw, 4) = Cells(Rw, 4)
        Cells(Rw, 3) = Cells(Rw, 1)
        Cells(Rw, 4) = Cells(Rw, 2)

    Next Rw
End Sub


Hi,
Thanks for the reply

But if the user has to select the range of data

and is should neglect the empty cell(means it should not copy both the cells) and it should go to the next data presenr in the next row

can help with this
 
Upvote 0
User has to select the range of data

and is should neglect the empty cell(means it should not copy both the cells) and it should go to the next data presenr in the next row

can help with this
 
Upvote 0
i will share a photo
data1.PNG
 
Upvote 0
if the given data is like this then the output should be like what it has show in the 2nd image
 
Upvote 0
unique Id is assigned for every single row by us when its created.
if the data is taken from that particular row it should also take the from which product code row it has fetched it and reflect the same product code column B
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,293
Members
449,077
Latest member
Rkmenon

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