View Single Post
  #22   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_2_] Don Guillett[_2_] is offline
external usenet poster
 
Posts: 1,522
Default Looking For A Formula

On Sep 4, 8:15*am, Don Guillett wrote:
On Sep 4, 12:54*am, GS wrote:









qcan has brought this to us :


On Sep 3, 8:04*pm, GS wrote:
Don Guillett explained on 9/3/2011 :


On Sep 3, 4:51*pm, GS wrote:
Don Guillett used his keyboard to write :
Insert a row at the top and put this in row2 and copy down
=IF(AND(COUNTIF(B2:H2,""&0),a1<"x"),"x","")
This does not place x for set#3 nor set#6 of the OP's sample data. It
needs to test both rows to determine the action to take on one or the
other.


--
Garry


Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Did you insert a row at the top. I can send a file or you can send me
yours
dguillett1 @gmail.com


Yes, I inserted a row at the top as you instructed. Are you saying you
get 1 x for each set of rows? Here are the results I get...
* * A-- B-- C-- D-- E-- F-- G-- H
1--
2-- x * 0 * * * 0 * * * 0 * * * 0 * * * 2 * * * 3 * * * 0_set1/row1
3-- * * 0 * * * 0 * * * 0 * * * 0 * * * 0 * * * 0 * * * 1_set1/row2
4-- * * 0 * * * 0 * * * 0 * * * 0 * * * 0 * * * 0 * * * 0_set2/row1
5-- x * 0 * * * 0 * * * 1 * * * 0 * * * 0 * * * 1 * * * 0_set2/row2
6-- * * 0 * * * 0 * * * 0 * * * 0 * * * 0 * * * 0 * * * 1_set3/row1 *'//no x
here 7-- * * 0 * * * 0 * * * 0 * * * 0 * * * 0 * * * 0 * * * 0_set3/row2
8-- x * 0 * * * 3 * * * 0 * * * 3 * * * 1 * * * 0 * * * 0_set4/row1
9-- * * 0 * * * 2 * * * 0 * * * 1 * * * 0 * * * 0 * * * 0_set4/row2
10- * * 0 * * * 0 * * * 0 * * * 0 * * * 0 * * * 0 * * * 0_set5/row1
11- x * 1 * * * 0 * * * 0 * * * 3 * * * 3 * * * 0 * * * 0_set5/row2
12- * * 0 * * * 0 * * * 1 * * * 1 * * * 1 * * * 0 * * * 0_set6/row1 *'//no x
here 13- * * 0 * * * 0 * * * 0 * * * 0 * * * 0 * * * 0 * * * 0_set6/row2


Why do you think your file would be set up different than mine, since I
set mine up as per your instructions?


--
Garry


Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc- Hide quoted text -


- Show quoted text -


Garry / Don,


Don,


I tried your formula. Sorry, It does not work properly.


Garry,


With regards to above with the results that you get - All is correct
on your small sample with the exception of set 3 and set 6. Why
wouldn't an "X" be returned on both of these sets ?


My sample DOES return an x for all 6 sets. Don's formula (return sample
above) DOES NOT return an x for sets 3/6 (as I stated here at the top).


Sounds to me like you're confused about who's/what return samples are
being provided. My code returns an x for all 6 sets as noted in my
reply (which also includes the macro I used to get those results)!


--
Garry


Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


Sorry....
Based on the second sample I guess I misunderstood the setup as it
appeared to me from the FIRST sample that the data sets were separated
by a row as in 1:2 4:5


Gary's seems to work. This macro does the same for whatever rows and
columns for 1:2 3:4 etc

Option Explicit
Sub PlaceX()
Dim lc As Long
Dim i As Long
lc = Cells.Find("*", Cells(Rows.Count, Columns.Count) _
, , , xlByRows, xlPrevious).Column' last column
Columns(1).ClearContents
For i = 1 To Cells(Rows.Count, 2).End(xlUp).Row Step 2
If Application.CountIf(Range(Cells(i, 2), Cells(i, lc)), "0") Then
Cells(i, 1) = "X"
ElseIf Application.CountIf(Range(Cells(i + 1, 2), Cells(i + 1, lc)),
"0") Then
Cells(i + 1, 1) = "X"
End If
Next i
End Sub