Column lookup macro

  • Hello Anna,

    See if this heads you in the right direction:-

    I've attached your sample workbook with the code implemented. The "Output" sheet is empty. Click on the "TEST ME" button to see how it works.

    I hope that this helps.




  • vcoolio this code works perfect.. Thanks a lot

    could you please explain the code how it works,

    Because the required output column order is this(1,2,3,4,5,6,7,8,9,10,11)

    In your code its specified as random order "Array(1, 2, 3, 10, 11, 12, 4, 5, 6, 7, 8)" and "column 9" header is missing (in the code).

    Additionally, is it possible to delimit and extract the data in output sheet?

    For eg..


    Column 10 has the below data

    1-2 Days Australia

    13-14 Days way Vietnam


    Required Output:










    Thanks for your reply..

    Is it possible to customize the order list? Because in the real data, Column headers will be in string..

  • Hello Anna,

    Column 9 is not included because, in your sample output, you have not included it (Coco).

    If you need it to be included, add 9 after the 8 in the array and change the resize value to 12.

    The array appears random but is in fact quite precise. You have asked that columns K, L and M (10, 11 &12 based on your data setout) in the Input sheet be placed in columns E, F and G in the Output sheet starting at B4. The positions of the columns in the array determines the positions in the Output sheet.

    I don't quite follow your last request so, seeing that your supplied sample is not truly indicative of your actual workbook and its data, please supply a new sample set out exactly the same as your actual workbook including the data within the columns (ensure that it is still dummy data).



Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!