Apr 15 2022 03:16 AM
I exported a file in Excel that shows two columns with min income and Max income. Now when I exported the file, Excel made three columns in total where I see majorly figures are in 2 columns but a few figures are shifted to 1 colum extra.
An example below.
A. B C
200 300
100 400
300 200
340 559
600 100
Now I need to know with a large data how I can place these figures back to column A and B ?
Apr 15 2022 04:20 AM
Sub shift()
Dim i As Integer
Dim lngzeilemax As Integer
lngzeilemax = Cells(Rows.Count, 2).End(xlUp).Row
For i = 1 To lngzeilemax
If Cells(i, 1).Value = "" Then
Cells(i, 1).Delete shift:=xlToLeft
Else
End If
Next i
End Sub
Maybe with these lines of code. Click the button in cell E3 in the attached file to start the macro.
Apr 15 2022 08:36 AM
=IF($A1<>"",A1,B1)
Maybe with this formula. The formula is entered in cell D1 in the attached example and copied across range D1:E46. Now you can copy this range and paste only values. Then you can delete columns A, B and C.