+ -
当前位置:首页 → 问答吧 → Excel 唔写 VBA 可否量 空行?

Excel 唔写 VBA 可否量 空行?

时间:2014-07-13

来源:互联网

DataSheet
A B
花花


草草

花花 草草

花花 草草
草草

花花
花花 草草

========================================
Result Sheet 想见到:

花花 草草
4 3
1 1
2 1
0 0
- 2

一个 Column 只得一样,唔系要删空行,而系要数有几多空行才下一次出现。

作者: catjoke   发布时间: 2014-07-13

可以

作者: bluenemo   发布时间: 2014-07-13

可否讲条 formula 点写?
一个 Column只有 花花 和 空行 或是 草草 和 空行
用 COUNTIF, SUMIF, frequency 都数唔到

作者: catjoke   发布时间: 2014-07-13

change 花花 to XX, change space to 花花, change XX to space. then count

作者: bluenemo   发布时间: 2014-07-13

引用:原帖由 catjoke 於 2014-6-28 02:12 PM 发表
可否讲条 formula 点写?
一个 Column只有 花花 和 空行 或是 草草 和 空行
用 COUNTIF, SUMIF, frequency 都数唔到
空格要用 "" 括住

=COUNTIF(A1:A12,"")

作者: 烟民贱过食屎9.   发布时间: 2014-07-13

引用:原帖由 烟民贱过食屎9. 於 2014/6/29 00:03 发表
空格要用 "" 括住

=COUNTIF(A1:A12,"")
佢出total出现次数,唔系个别result sheet结果
过千行的话,唔可能人手定检查row range
我唔系整行的count,系断开一截截的count

望多次result sheet要求

换唔换 space 做XX都无意思,countif 计全个栏

作者: catjoke   发布时间: 2014-07-13

suppose you are tackling column A.

get the row() if the cell contains value.

there are excel formula (quite long, and a little bit comoplicated) which can take away all empty cells between cells within same column/ row. good oldies. search the web for it.

then, you do the subtraction for each row, value = value of row(i+1) - value of row(i) - 1.

done.

作者: stevie1   发布时间: 2014-07-13

写详细D:

1.转""去"XX",转"花花"去"",转"XX"去"花花"
2.=IF(A1="花花",1,0)
3.Subtotal
4.Copy Subtotals
5.Advanced Filter Subtotals
6.Done


[ 本帖最后由 bluenemo 於 2014-6-29 06:19 AM 编辑 ]

作者: bluenemo   发布时间: 2014-07-13

引用:原帖由 stevie1 於 2014/6/29 04:15 发表
suppose you are tackling column A.

get the row() if the cell contains value.

there are excel formula (quite long, and a little bit comoplicated)
which can take away all empty cells between cells within same column/ row.
good oldies. search the web for it.

then, you do the subtraction for each row, value = value of row(i+1) - value of row(i) - 1.

done..
唔覆杂,一句就出ROW Number:
复制内容到剪贴板代码:=IF(A2="",0,ROW())
删0要系抄出其他 Worksheet度做,出到结果。

作者: catjoke   发布时间: 2014-07-13

引用:原帖由 bluenemo 於 2014/6/29 06:06 发表
写详细D:

1.转""去"XX",转"花花"去"",转"XX"去"花花"
2.=IF(A1="花花",1,0)
3.Subtotal
4.Copy Subtotals
5.Advanced Filter Subtotals
6.Done
Step 1 系要既,
但 Step2 多余!
小计可以有 项目个数,等同用 COUNT
大致都叫做到。

作者: catjoke   发布时间: 2014-07-13

引用:原帖由 stevie1 於 2014/6/29 04:15 发表
suppose you are tackling column A.

get the row() if the cell contains value.

there are excel formula (quite long, and a little bit comoplicated)
which can take away all empty cells between cells within same column/ row.
good oldies. search the web for it.

then, you do the subtraction for each row, value = value of row(i+1) - value of row(i) - 1.

done.
最后用你的方法,只是条公式代替出ROW() 又计减数:
复制内容到剪贴板代码:=IF(MATCH(A$1,A2:A1000,FALSE)-MATCH(A$1,A3:A1001,FALSE)=1,"",MATCH(A$1,A3:A1001,FALSE)-1)
因为咁样 1 Step已经出佐 空格或者 答案。
搬出街 删走空行就可以抄返回去。
始终 formula 系最难用得好的一关……

作者: catjoke   发布时间: 2014-07-13

PIVOT TABLE搞点佢啦

作者: yfly480   发布时间: 2014-07-13

C1 = 0
C2 =IF(A1<>"花花",C1+1,0)

copy format to the end
咁样

[ 本帖最后由 sk860811 於 2014-6-30 05:33 PM 编辑 ]

作者: sk860811   发布时间: 2014-07-13

引用:原帖由 sk860811 於 2014/6/30 17:31 发表
C1 = 0
C2 =IF(A1"花花",C1+1,0)

copy format to the end
咁样
整串:
0
1
2
3
4
0
1
0
1
2

搞完又要再加多句, =IF(D2=0,D1,0) 才出返我上面 match的结果……

作者: catjoke   发布时间: 2014-07-13