Forum Discussion

BDCanuck's avatar
BDCanuck
Copper Contributor
Oct 27, 2022
Solved

Help checking and re-ordering columns

Hello all,

 

I have data that comes to me in a long line of columns that are regularly switched around. Every week I need to move the columns to make the data conform to a spreadsheet that has a bunch of formulas.

 

Is there a formula I can use to make Excel tell me where to move the column?

 

What I have now outputs something like this: 

 

Column Headers in correct orderColumn Headers to be checked from worked filesComparison Check
AAGood
BCBad
CDBad
DBBad
EEGood

 

What I'd like is something where a formula told me how far to move a column. It would output something like this:

 

Column Headers in correct orderColumn Headers to be checked from worked filesComparison CheckMove Column:
AAGood0
BCBad1
CDBad1
DBBad-2
EEGood0

 

So move Column C one place right, D one place right, and B two places left.

 

Is this possible?

    • BDCanuck's avatar
      BDCanuck
      Copper Contributor
      Thank you! That worked! For anyone else curious, there was a little bit of German left in the formula that OliverScheurich suggested. The formula for English Excel is =CELL("Col",INDIRECT(B2&"1"))-CELL("Col",INDIRECT(A2&"1"))

Resources