多行数字的筛选

cyerp 2012-03-24 05:01:47
说明:

一行有7组数据每组数据之间已“+”号分开,每行数据已“,”号分开


问题:
在以下多行数据中第1组数据和第6组数据 有连续3行一样的数字的筛选出来,并且前后个留5行。
改如果实现?

例如:
条件1
---------------------------------------------------
01+08+09+14+19+24+26,
01+02+03+05+08+13+26, 第一组有3行都是相同的
01+06+10+18+21+26+30,

显示的结果:
07+09+11+14+17+19+25,
05+10+14+18+19+21+28,
02+06+07+10+12+14+26,
01+04+11+15+24+25+27,
04+12+14+25+26+29+30,
01+08+09+14+19+24+26,
01+02+03+05+08+13+26, 前后个留5行
01+06+10+18+21+26+30,

04+15+17+18+22+24+29,
09+12+15+22+25+27+29,
02+06+10+17+18+27+28,
01+09+13+18+19+22+26,
01+05+06+11+12+26+30,


第6组如果有相同3行数据显示方式跟上面举例是一样显示的












----------------------------------------------------------------------------------------
测试数据

07+09+11+14+17+19+25,
05+10+14+18+19+21+28,
02+06+07+10+12+14+26,
01+04+11+15+24+25+27,
04+12+14+25+26+29+30,
01+08+09+14+19+24+26,
01+02+03+05+08+13+26,
01+06+10+18+21+26+30,

04+15+17+18+22+24+29,
09+12+15+22+25+27+29,
02+06+10+17+18+27+28,
01+09+13+18+19+22+26,
01+05+06+11+12+26+30,
04+05+07+12+20+21+29,
04+05+08+17+24+25+26,
02+08+11+14+16+25+30,
09+10+14+18+23+25+26,

06+13+16+19+20+22+25,
07+12+13+22+23+27+28,
01+05+06+09+24+28+30,
02+04+07+09+13+20+22,
01+11+20+21+24+25+29,
01+10+13+20+27+28+29,
09+12+13+18+19+24+26,
01+02+14+17+18+19+29,
02+04+06+16+18+27+30,
08+11+15+18+26+27+28,
05+09+14+18+22+25+27,
01+03+07+14+18+26+30,
04+12+13+17+19+29+30,
...全文
188 点赞 收藏 9
写回复
9 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
worldy 2012-03-26
[Quote=引用 7 楼 cyerp 的回复:]
worldy:
显示的不对啊?
[/Quote]

怎么不对,你自己检查一下边上的数字,那就是连续三行都有的
回复
cyerp 2012-03-26
谢谢 各位帮忙解决下
回复
cyerp 2012-03-26
worldy:
显示的不对啊?
回复
worldy 2012-03-25
[Quote=引用 3 楼 vansoft 的回复:]
直接转成MDB文件中,用SQL语句查询即可。
七个字段,
[/Quote]

那个人的数据没有规律,select是select不出来滴
回复
vrgame 2012-03-25
奇怪的數據...
回复
vansoft 2012-03-24
直接转成MDB文件中,用SQL语句查询即可。
七个字段,
回复
wushuiyousheng 2012-03-24
wa,haochang
回复
worldy 2012-03-24
Option Explicit
Dim sData As String

Private Sub Command1_Click()
Cls
Dim A() As String
Dim B() As String
Dim i As Long, j As Long
Dim s As String
Dim bFound As Boolean

A = Split(sData, "," & vbCrLf)
For i = 0 To UBound(A) - 2
B = Split(A(i), "+")
For j = 0 To UBound(B)
s = Trim(B(j))
If InStr(1, A(i + 1), s) > 0 Then
If InStr(1, A(i + 2), s) > 0 Then
bFound = True
Exit For
End If
End If
Next
If bFound Then
ForeColor = 255
Print A(i); Space(10); s
Print A(i + 1)
Print A(i + 2)
ForeColor = 0
i = i + 2
bFound = False
Else
Print A(i)
End If
Thenext:
Next
If Not bFound Then
For j = i To UBound(A)
Print A(j)
Next
End If

End Sub

Private Sub Form_Load()
sData = "07+09+11+14+17+19+25,"
sData = sData & vbCrLf & "05+10+14+18+19+21+28,"
sData = sData & vbCrLf & "02+06+07+10+12+14+26,"
sData = sData & vbCrLf & "01+04+11+15+24+25+27,"
sData = sData & vbCrLf & "04+12+14+25+26+29+30,"
sData = sData & vbCrLf & "01+08+09+14+19+24+26,"
sData = sData & vbCrLf & "01+02+03+05+08+13+26,"
sData = sData & vbCrLf & "01+06+10+18+21+26+30,"
sData = sData & vbCrLf & "04+15+17+18+22+24+29,"
sData = sData & vbCrLf & "09+12+15+22+25+27+29,"
sData = sData & vbCrLf & "02+06+10+17+18+27+28,"
sData = sData & vbCrLf & "01+09+13+18+19+22+26,"
sData = sData & vbCrLf & "01+05+06+11+12+26+30,"
sData = sData & vbCrLf & "04+05+07+12+20+21+29,"
sData = sData & vbCrLf & "04+05+08+17+24+25+26,"
sData = sData & vbCrLf & "02+08+11+14+16+25+30,"
sData = sData & vbCrLf & "09+10+14+18+23+25+26,"
sData = sData & vbCrLf & "06+13+16+19+20+22+25,"
sData = sData & vbCrLf & "07+12+13+22+23+27+28,"
sData = sData & vbCrLf & "01+05+06+09+24+28+30,"
sData = sData & vbCrLf & "02+04+07+09+13+20+22,"
sData = sData & vbCrLf & "01+11+20+21+24+25+29,"
sData = sData & vbCrLf & "01+10+13+20+27+28+29,"
sData = sData & vbCrLf & "09+12+13+18+19+24+26,"
sData = sData & vbCrLf & "01+02+14+17+18+19+29,"
sData = sData & vbCrLf & "02+04+06+16+18+27+30,"
sData = sData & vbCrLf & "08+11+15+18+26+27+28,"
sData = sData & vbCrLf & "05+09+14+18+22+25+27,"
sData = sData & vbCrLf & "01+03+07+14+18+26+30,"
sData = sData & vbCrLf & "04+12+13+17+19+29+30,"


End Sub
回复
相关推荐
发帖
VB基础类
创建于2007-09-28

7518

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2012-03-24 05:01
社区公告
暂无公告