1
I have a search tool I am developing in Excel. In Column "EU", I have cells, each containing a string of 124 digits. These strings consist of 0's and 1's. I have 124 characteristics that produce the 1 or 0..., and users may want to search for 1,2,3,4,5 etc. characteristics. For simplicity, let's say EU1 has string 0100100011.....and I want to find any cell that contains 0100100000 or possibly 0000100010 etc. In other words I want to find any string containing a "1" in a specific digit location, possibly several 1's in several digit locations.......... Example I want to test if any of these 3 combinations.....
0000010000000001000000000000010010000010000000100000010010010000000000101100100000100000000000000000000000000000000000000100 0000000000001010001000000010010010010010000000100000010010010000000000100100100000100100000100000000000000000000000001000100 0000000000000110000010000010001001010000010000100000010010010000000000100100100001000100000100000000000000000000000001000100
have 1's in these locations......
1000000000000000000000000000000000000000000000000000000000000000000001000000000000000000001000100000000000000000000000000000
if there are 1's in other locations that is fine, but not if the test condition has a 1 and the tested locations have a zero in that digit.
Putting it another way, and using more comprehensible examples, pretend that my strings are only five characters long, and that my first five strings are
EU1 10000
EU2 10001
EU3 11000
EU4 11011
EU5 00001
I want to search for strings
where all of a designated list of character positions contain 1
s,
by comparing each of them to a variable search string
that contains 1
at all the positions where I want there to be a 1
.
Zeros in the variable are wildcards.
Another way to put it is that the search string acts as a mask.
For example, to find strings whose first two digits are 1
s
(don’t care about the rest)
I would want to specify 11000
and get matches to strings EU3 and EU4.
(This might represent a search for objects that are Angular AND Blue.)
A search on 10000
(all objects that are Angular)
should match on all the strings
whose first digit is 1
, namely EU1, EU2, EU3, and EU4.
11100
(all objects that are Angular AND Blue AND Circular)
should yield no match,
because no strings contain 1
in the place of the third digit.
Conversely, 00000
should match all the strings,
because an all-zeros search string is a wildcard.
In table form:
Search string: 11000 10000 11100 00000 ↓↓ ↓ ↓↓↓ EU1 10000 → 10000 10000 → 10000 EU2 10001 → 10001 10001 → 10001 EU3 → 11000 → 11000 11000 → 11000 EU4 → 11011 → 11011 11011 → 11011 EU5 00001 00001 00001 → 00001 (none) (all)
I'm sorry that your data are 128 characters long. A solution for your 128-character problem will probably work for 8 or 18 characters as well, and vice versa. I suggest that "For simplicity" you scale down your problem so that your strings fit on one line — your actual data hurt my eyes. – Scott – 2015-10-26T02:06:58.797
I have 5 strings. String A)=10000, String B)=10001, String C)=11000 String, D)=11011, String E)=00001. I would like to compare each of these strings to a variable. So if Variable A)=11000 I would get a match to string C and D. If Var A)=10000, match on strings A,B,C, and D. If Var A)=11100, no match, because no strings contain "1" in the place of the 3rd digit. So any time a "1" shows up in the variable it is critical that the string contains the 1 as well. If the Variable A)=00000 then strings A,B,C,D, and E are all a match, as zeros in the variable are wildcards. – BearOnFire – 2015-10-27T03:19:22.283