Hi,
I am using Excel 2010. I am a novice user.
I have a lot of data to filter / sort.
I want to initially to create a filter for a column of data - which has the format similar to hierarchical paths to files.
The data is a mix of text/numbers. e.g.
pathA/path_X/path_Y/path_Z/lso0_rxs_reg_254__5_0/d
pathA/path_X/path_Y/path_Z/lso0_rxs_reg_253__5_0/d
pathA/path_123/path_456/data_out_reg_17_0/d
pathA/path_123/path_456/data_out_reg_0_0/d
pathA/path_X/path_Y/path_Z/lso0_rxs_reg_255__5_0/d
pathA/path_X/path_Y/path_Z/path_D1/lfc_out_rxs_reg_4_0/d
pathA/path_123/path_456/data_out_reg_4_0/d
pathA/path_X/path__AA/path__AB/secure_push_data_rxs_reg_52_0/d
pathA/path_X/path_Y/path_Z/path_D1/lfc_out_rxs_reg_1_0/d
pathA/path_X/path__AA/path__AB/push_byte_offset_rxs_reg_2_0/d
pathA/path_X/path_Y/path_Z/path_D1/lfc_out_rxs_reg_2_0/d
pathA/path_X/path_Y/path_Z/lso0_rxs_reg_237__6_0/d
pathA/path_X/path_Y/path_Z/path_D1/calc_lcode_rxs_reg_13_0/d
pathA/path_X/path__AA/path__AB/ssm_ath1_push_data_rxs_reg_52_0/d
pathA/path_X/path_Y/path_Z/path_D1/calc_lcode_rxs_reg_6_0/d
pathA/path_X/path__AA/path__AB/ssm_pke3_push_data_rxs_reg_26_0/d
pathA/path_X/path__AA/path__AB/ssm_pke4_push_data_rxs_reg_26_0/d
pathA/path_X/path_Y/path_Z/lsymb0_1_0_rxs_reg_3_0/d
pathA/path_X/path_Y/path_Z/lso0_rxs_reg_230__6_0/d
pathA/path_X/path_Y/path_Z/path_D1/calc_lcode_rxs_reg_12_0/d
Doing an alphabetical sort of this date would return the following order.
As you can see while each strings in unique - there are many instances where they are simialr - if you ignore the unique numberic values at the end of the string.
pathA/path_123/path_456/data_out_reg_0_0/d
pathA/path_123/path_456/data_out_reg_17_0/d
pathA/path_123/path_456/data_out_reg_4_0/d
pathA/path_X/path_Y/path_Z/lso0_rxs_reg_230__6_0/d
pathA/path_X/path_Y/path_Z/lso0_rxs_reg_237__6_0/d
pathA/path_X/path_Y/path_Z/lso0_rxs_reg_253__5_0/d
pathA/path_X/path_Y/path_Z/lso0_rxs_reg_254__5_0/d
pathA/path_X/path_Y/path_Z/lso0_rxs_reg_255__5_0/d
pathA/path_X/path_Y/path_Z/lsymb0_1_0_rxs_reg_3_0/d
pathA/path_X/path_Y/path_Z/path_D1/calc_lcode_rxs_reg_12_0/d
pathA/path_X/path_Y/path_Z/path_D1/calc_lcode_rxs_reg_13_0/d
pathA/path_X/path_Y/path_Z/path_D1/calc_lcode_rxs_reg_6_0/d
pathA/path_X/path_Y/path_Z/path_D1/lfc_out_rxs_reg_1_0/d
pathA/path_X/path_Y/path_Z/path_D1/lfc_out_rxs_reg_2_0/d
pathA/path_X/path_Y/path_Z/path_D1/lfc_out_rxs_reg_4_0/d
pathA/path_X/path__AA/path__AB/push_byte_offset_rxs_reg_2_0/d
pathA/path_X/path__AA/path__AB/secure_push_data_rxs_reg_52_0/d
pathA/path_X/path__AA/path__AB/ssm_ath1_push_data_rxs_reg_52_0/d
pathA/path_X/path__AA/path__AB/ssm_pke3_push_data_rxs_reg_26_0/d
pathA/path_X/path__AA/path__AB/ssm_pke4_push_data_rxs_reg_26_0/d
So what I want to do is to create a filter for the strings - but ignoring the numeric bits at the end i.e.
reg_[0-9]+_+[0-9]+/d
The strings are obviiously of varying length and the number of hierarchical paths is different,
so I can't split string on "/".
Similarly folder paths names can contain "_" so can't split string on this either.
As I don't know how many "/" or "-" instances there will be in the string I don't believe I can use the find function.
Also as the amount of number will be different i don't think I can use =right(a1,X) either.
I may be able to search for the pattern above - as this is probabay unique - so maybe it's something like the following pseudo code:
Function GetString(txt As String) As String
With CreateObject("VBScript.RegExp")
.Pattern = "reg_\d+(_)+\d+//d"
GetString = .execute(txt)(0)
End With
End Function
If I do require VBA code - how do I then use this for creating a column filter?
Or will I have to extract the filtered data first from the column (and its associated row data) into another worksheet to use?
Once I have the filter in place I want to create tables using the filtered data -
so for example each column value above has a lot of associated data values in each row e.g
26 pathA/path_123/path_456/data_out_reg_0_0/d
32 pathA/path_123/path_456/data_out_reg_17_0/d
8 pathA/path_123/path_456/data_out_reg_4_0/d
So my table would show the name "data_out_reg" and the range of values 8-32.
Anyway hopefully someone can help with the first part
Thanks
Neil
Bookmarks