May 21 2021 07:19 AM
May 21 2021 07:19 AM
I have a very long list of data showing image file path names from multiple folders. I want to be able to sort this data into five columns (CAM1,CAM2,CAM3,CAM4 and Sphere).
I am able to copy and paste the data but it takes a significant amount of time to sort through as the sequence is
TrackbCAM1, TrackbCAM2, TrackbCAM3, TrackbCAM4, trackbsphere, TrackcCAM1, TrackcCAM2, TrackcCAM3 etc....
Does anyone know a quick way to sort this in excel? Any help would be very much appreciated.
May 21 2021 07:55 AMSolution
If you have Excel in Microsoft 365, you can use the new FILTER function for this.
Otherwise, Advance Filter (Data tab of the ribbon > Advanced) is a quick way to do this.
First, insert a header in A1. I used File, but it can be anything.
Set up a criteria range: File in cell C1 (spelled exactly as in A1) and *CAM1* in C2.
Also set up a copy-to range: File in cell D1 (as in A1).
Select A1 and click Advanced.
Ignore the warning that Excel puts up.
Specify the criteria range, select 'Copy to another range' and specify the Copy to range:
Do the same for the other cameras. It took me less time to execute than to write this down.
See the attached version.
May 24 2021 04:58 AM
Would anyone know how to get the file path to show in numerical order for this data also?
At the moment it goes 1,10,100,1000, 1001,1002 etc but I would rather it went 1,2,3,4,5...
I tried the az sort button but nothing changed
May 24 2021 06:49 AM
The macro loads a column into an array in memory.
It then uses string functions such as InStr, Left, Mid and Format to expand the numbers after the camera such as 1, 12, 103 to four digits: 0001, 0012, 0103.
The new values are written to the column to the right. The two columns are sorted on the second column (the one with the expanded numbers).
Finally, that second column is cleared again.
Because array operations are relatively fast, the macro only takes a few seconds to run.
You can view the code in the Visual Basic Editor.
May 27 2021 08:14 AM
Is there a way in which I join two macros together to make one? I have made your first solution into a macro aswell and thought it would make things very simply if i was able to join them together!