Forum Discussion
JacquesRedding
May 11, 2023Copper Contributor
Align Excel Data in Colum's
Hi There, Can someone tell me how to Align the data in Column C, to the data in column D?
OliverScheurich
May 11, 2023Gold Contributor
JacquesRedding
May 11, 2023Copper Contributor
- OliverScheurichMay 11, 2023Gold Contributor
HansVogelaar already explained why the problem occurs. If you open the attached file the formula is shown in your language.
An alternative could be Power Query. In the attached file you can add data to the blue dynamic table. Then you can click in any cell of the green table and right-click with the mouse and select refresh to update the green result table.
- HansVogelaarMay 11, 2023MVP
If you use comma as decimal separator, use
=INDEX($C$1:$C$26;MATCH(D1;$C$1:$C$26;0))
Here is a macro that will align column D in place:
Sub AlignD() Dim rc As Long Dim rd As Long Dim mc As Long Dim md Dim vc() Dim vd() Dim vn() Dim t As Single Application.ScreenUpdating = False t = Timer mc = Range("C1").End(xlDown).Row vc = Range("C1:C" & mc).Value ReDim vn(1 To mc, 1 To 1) md = Range("D1").End(xlDown).Row vd = Range("D1:D" & md).Value For rd = 1 To md rc = Application.Match(vd(rd, 1), vc, 0) vn(rc, 1) = vc(rc, 1) Next rd Range("D1:D" & mc).Value = vn t = Timer - t Debug.Print t Application.ScreenUpdating = True End Sub