Hi Forum,
I'm looking for any easier/more elegant way to accomplish what I describe below.
--> any ideas for improvement would be greatly appreciated. You don't have to go into any depth - I'll try to figure out what your saying first before replying with a daft question!
This is probably asking quite a lot......I would prefer to give you a bite sized problem in isolation, but, I'm really looking for a more elegant solution to the whole concept:
I have a fair bit of 'past' programming experience, mainly assembly games programming (Apple II/CMB64/Amiga). I don't work in IT - I'm hospital lab-based, however, some time ago I designed a visual basic program to analyse a linked spreadsheet database and notify the user if he/she entered 4 values which matched any adjacent 4 values in the database. Additional very useful functionality was also incorporated. I submitted it for 'work' use (our current 'search' method relies, unbelievably, on manually eying a 1400 line excel database !!!) but unfortuanately, red tape and other issues have resulted in me having to rethink this problem without using the excel visual basic macro route.......
- So, my new method using excel's cell formulas:-
1. I have 4 horizontally adjacent cells that I've labelled "patA1", "PatA2", PatB1", "PatB2". The user enters data-restricted input into these 4 cells - 2 different fixed sets of data restricted integers - one for both PatA cells and one for both PatB cells.
i.e:
<TABLE style="WIDTH: 192pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=256><COLGROUP><COL style="WIDTH: 48pt" span=4 width=64><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: aqua; WIDTH: 192pt; HEIGHT: 12.75pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: black 0.5pt solid" class=xl68 height=17 width=256 colSpan=4>
.....1,30 (PatA1/2),51,8 (PatB1/2) have been entered by the user.
- The user may enter null or duplicate data at one each of A or B at the 4 cells above e.g. "1","","51","8", or, "1","1","51",""
2. The main excel spreadsheet comprises about 1400 lines of data. Each line of data includes 4 adjacent cells which may or may not contain the same sequence as that entered by the user.
i.e in columns (D-G) we have:
[the first data line,below, 2,30,8,51 is row 5]
D E F G
<TABLE style="WIDTH: 192pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=256><COLGROUP><COL style="WIDTH: 48pt" span=4 width=64><TBODY><TR style="HEIGHT: 26.25pt" height=35><TD style="BORDER-BOTTOM: windowtext 2pt double; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; WIDTH: 48pt; HEIGHT: 26.25pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl67 height=35 width=64>
etc
3. Just like the user-entered search, the data above may include null or duplicate cells. Just like PatA1/2 and PatB1/2 data in columns D+E and F+G are restricted to restriction sets A (D+E) and B (F+G).
4. I need to search each row of data (D-G) for and flag up to the user any of the match types he/she entered into PatA1,PatA2,PatB1,PatB2.
- any data lines that contain the following A permutations are considered as matches:
PatA1,PatA2
PatA1, PatA1
PatA2,PatA1
PatA2,PatA2
PatA1,Null
PatA2,Null
Null,PatA1
Null,PatA2
- Substitute the "A" above for "B" and we have the same 8 rules applied to the 2 "B" data cells.
5. Taking the above example where the user enters 1,30,51,8 I've highlighted in red the possible matches....note that as long as any 4 adjacent data cells do not contain values outside the user-entered A or B values, or, any of these in combination with a null value, then, a positive match is returned.
6. In addition to the above, I have included the Label, "CompAg", which defines a range of 20 adjacent cells containing additional user-entered search data (restricted to both A and B acceptable data sets....in that.....the user can enter up to 20 values taken from any mixed combination of A and B data-restricted integers sets.
7. An acceptable search match will now be flagged to the user if any combination of CompAg values, + / - the 4 use entered values, are matches to any row in the main data set in (D-G).
----------------------
To accomplish all this I have added 8 columns to the immediate right of the main database cells. These 8 columns contain various functions, allowing me to break the problem down into easier to see steps, as follows (taking database Row 5 as an example) :-
A) 4 columns at O-R containing, at column O:-
=IF(OR(D5=PatA1,D5=PatA2,D5="")=TRUE,"",IF(ISNA(MATCH(D5,CompAg,0)=FALSE),"x",""))
and at column P:-
=IF(OR(E5=PatA1,E5=PatA2,E5="")=TRUE,"",IF(ISNA(MATCH(E5,CompAg,0)=FALSE),"x",""))
- Columns Q and R are as above but look at database entries F and G respectively
-The database is contained in columns D-G.
- As described above, CompAg holds an array of up to 20 values of additionally 'acceptable' match alternatives.
- In the above, D5-G5 contain the database entries currently being searched for in the user-entered PatA/B/1/2.
- The cell numbers are incremented as the 4 formulas are repeated downwards, checking the 4 database entries in each adjacent line.
Result: - an "x" is returned upon a non-match, a "" is returned for a match.
B) To Check for double-null entries in database values at either D and E, or, F and G, Columns S contains:-
=IF(AND(D5="",E5=""),2,0)
and column T contains:-
=IF(AND(F5="",G5=""),2,0)
Result: - an "2" is returned for a double Null, a "" is returned if not.
C) The number of matches returned is displayed to the user in Column M as follows:-
= (COUNTBLANK(O5:R5)-(S5+T5))
D) A Full match is displayed in column L as follows:-
=IF(M6=4,"MATCH","")
----------------------------------
-->This does appear to work!!, though logic checking may be incomplete (not bug-free)..........
--> Though, I'm essentially looking to see if there is a better way to do the above.
---> I've found this way of working - using only excel cell formulas (no VB macros allowed) - to be quite a bit limiting, frustrating and challenging.
....And that's about it!!! If you've got this far I thank you, if not, no probs....I am definitely asking quite a bit.
I'm looking for any easier/more elegant way to accomplish what I describe below.
--> any ideas for improvement would be greatly appreciated. You don't have to go into any depth - I'll try to figure out what your saying first before replying with a daft question!
This is probably asking quite a lot......I would prefer to give you a bite sized problem in isolation, but, I'm really looking for a more elegant solution to the whole concept:
I have a fair bit of 'past' programming experience, mainly assembly games programming (Apple II/CMB64/Amiga). I don't work in IT - I'm hospital lab-based, however, some time ago I designed a visual basic program to analyse a linked spreadsheet database and notify the user if he/she entered 4 values which matched any adjacent 4 values in the database. Additional very useful functionality was also incorporated. I submitted it for 'work' use (our current 'search' method relies, unbelievably, on manually eying a 1400 line excel database !!!) but unfortuanately, red tape and other issues have resulted in me having to rethink this problem without using the excel visual basic macro route.......
- So, my new method using excel's cell formulas:-
1. I have 4 horizontally adjacent cells that I've labelled "patA1", "PatA2", PatB1", "PatB2". The user enters data-restricted input into these 4 cells - 2 different fixed sets of data restricted integers - one for both PatA cells and one for both PatB cells.
i.e:
<TABLE style="WIDTH: 192pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=256><COLGROUP><COL style="WIDTH: 48pt" span=4 width=64><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: aqua; WIDTH: 192pt; HEIGHT: 12.75pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: black 0.5pt solid" class=xl68 height=17 width=256 colSpan=4>
Enter Search
</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: aqua; HEIGHT: 12.75pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl66 height=17>A1
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: aqua; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl66>A2
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: aqua; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl66>B1
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: aqua; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl66>B2
</TD></TR><TR style="HEIGHT: 26.25pt" height=35><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: #ff9900; HEIGHT: 26.25pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl67 height=35>1
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: #ff9900; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl67>30
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: #ff9900; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl67>51
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: #ff9900; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl67>8
</TD></TR></TBODY></TABLE>.....1,30 (PatA1/2),51,8 (PatB1/2) have been entered by the user.
- The user may enter null or duplicate data at one each of A or B at the 4 cells above e.g. "1","","51","8", or, "1","1","51",""
2. The main excel spreadsheet comprises about 1400 lines of data. Each line of data includes 4 adjacent cells which may or may not contain the same sequence as that entered by the user.
i.e in columns (D-G) we have:
[the first data line,below, 2,30,8,51 is row 5]
D E F G
<TABLE style="WIDTH: 192pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=256><COLGROUP><COL style="WIDTH: 48pt" span=4 width=64><TBODY><TR style="HEIGHT: 26.25pt" height=35><TD style="BORDER-BOTTOM: windowtext 2pt double; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; WIDTH: 48pt; HEIGHT: 26.25pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl67 height=35 width=64>
A1
</TD><TD style="BORDER-BOTTOM: windowtext 2pt double; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl67 width=64>A2
</TD><TD style="BORDER-BOTTOM: windowtext 2pt double; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl67 width=64>B1
</TD><TD style="BORDER-BOTTOM: windowtext 2pt double; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl67 width=64>B2
</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 13.5pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 0.5pt solid" class=xl68 height=18>2
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 0.5pt solid" class=xl68>30
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 0.5pt solid" class=xl68>8
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 0.5pt solid" class=xl68>51
</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=17>1
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>8
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>51
</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=17>1
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>30
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>51
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>8
</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=17>30
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>1
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>51
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>8
</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=17>1
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>1
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>8
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>
</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=17>1
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>30
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>8
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>51
</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=17>
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>30
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>8
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>51
</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=17>1
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>1
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>8
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>8
</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=17>1
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>1
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>51
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>51
</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 0.5pt solid" class=xl68 height=17>1
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 0.5pt solid" class=xl68>30
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 0.5pt solid" class=xl68>8
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: windowtext 0.5pt solid" class=xl68>8
</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=17>1
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>30
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>51
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>51
</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=17>
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl69>3
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>8
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>51
</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=17>1
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>51
</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>8
</TD></TR></TBODY></TABLE>etc
3. Just like the user-entered search, the data above may include null or duplicate cells. Just like PatA1/2 and PatB1/2 data in columns D+E and F+G are restricted to restriction sets A (D+E) and B (F+G).
4. I need to search each row of data (D-G) for and flag up to the user any of the match types he/she entered into PatA1,PatA2,PatB1,PatB2.
- any data lines that contain the following A permutations are considered as matches:
PatA1,PatA2
PatA1, PatA1
PatA2,PatA1
PatA2,PatA2
PatA1,Null
PatA2,Null
Null,PatA1
Null,PatA2
- Substitute the "A" above for "B" and we have the same 8 rules applied to the 2 "B" data cells.
5. Taking the above example where the user enters 1,30,51,8 I've highlighted in red the possible matches....note that as long as any 4 adjacent data cells do not contain values outside the user-entered A or B values, or, any of these in combination with a null value, then, a positive match is returned.
6. In addition to the above, I have included the Label, "CompAg", which defines a range of 20 adjacent cells containing additional user-entered search data (restricted to both A and B acceptable data sets....in that.....the user can enter up to 20 values taken from any mixed combination of A and B data-restricted integers sets.
7. An acceptable search match will now be flagged to the user if any combination of CompAg values, + / - the 4 use entered values, are matches to any row in the main data set in (D-G).
----------------------
To accomplish all this I have added 8 columns to the immediate right of the main database cells. These 8 columns contain various functions, allowing me to break the problem down into easier to see steps, as follows (taking database Row 5 as an example) :-
A) 4 columns at O-R containing, at column O:-
=IF(OR(D5=PatA1,D5=PatA2,D5="")=TRUE,"",IF(ISNA(MATCH(D5,CompAg,0)=FALSE),"x",""))
and at column P:-
=IF(OR(E5=PatA1,E5=PatA2,E5="")=TRUE,"",IF(ISNA(MATCH(E5,CompAg,0)=FALSE),"x",""))
- Columns Q and R are as above but look at database entries F and G respectively
-The database is contained in columns D-G.
- As described above, CompAg holds an array of up to 20 values of additionally 'acceptable' match alternatives.
- In the above, D5-G5 contain the database entries currently being searched for in the user-entered PatA/B/1/2.
- The cell numbers are incremented as the 4 formulas are repeated downwards, checking the 4 database entries in each adjacent line.
Result: - an "x" is returned upon a non-match, a "" is returned for a match.
B) To Check for double-null entries in database values at either D and E, or, F and G, Columns S contains:-
=IF(AND(D5="",E5=""),2,0)
and column T contains:-
=IF(AND(F5="",G5=""),2,0)
Result: - an "2" is returned for a double Null, a "" is returned if not.
C) The number of matches returned is displayed to the user in Column M as follows:-
= (COUNTBLANK(O5:R5)-(S5+T5))
D) A Full match is displayed in column L as follows:-
=IF(M6=4,"MATCH","")
----------------------------------
-->This does appear to work!!, though logic checking may be incomplete (not bug-free)..........
--> Though, I'm essentially looking to see if there is a better way to do the above.
---> I've found this way of working - using only excel cell formulas (no VB macros allowed) - to be quite a bit limiting, frustrating and challenging.
....And that's about it!!! If you've got this far I thank you, if not, no probs....I am definitely asking quite a bit.