Home » excel » Excel Line up columns within rows

Excel Line up columns within rows

Posted by: admin May 14, 2020 Leave a comment

Questions:

Within Excel I need to be able to line up the last two columns within each row. I have around 1000+ rows of “messy data”. The last two columns include bank account number and sort code. They will always be the last two columns but differ which column there are in for each row. I need the account number and sort code to be in column J & K. Screen shot below. excel spreadsheet example

How to&Answers:

You can use INDEX/COUNTA:

=INDEX($A1:$H1,COUNTA($A1:$H1)-(2-COLUMN(A:A)))

copy over one and down the length of the data.

enter image description here

Answer:

Alternatively, knowing that your two last columns will always be a sort code (text) and an account number (number), you can use our old friend HLOOKUP:

=HLOOKUP(REPT("z",255),A1:H1,1,TRUE)

=HLOOKUP(10^100,A1:H1,1,TRUE)

Result:

enter image description here

enter image description here