简体   繁体   English

如何计算excel中包含文本/数字的行数

[英]how can I count number of rows that contains text/numbers in excel

I want to count all rows in a range that contains either text or numbers, what formula can I use for that?我想计算包含文本或数字的范围内的所有行,我可以使用什么公式? I tried this but it does not count correct...我试过这个,但它不算正确......

=COUNTIF(B2:B50;"*") + SUMPRODUCT( -- ISTEXT(B2:B50))

data/text in cells can be like this...单元格中的数据/文本可以是这样的......

    S
    160
    XS
    M

To count both text and numbers, use COUNTA > =COUNTA(B2:B50)要同时计算文本和数字,请使用COUNTA > =COUNTA(B2:B50)

Be aware that this does also count empty formulas!请注意,这也计算空公式!

To make your original formulas work.使您的原始公式有效。

You can use您可以使用

=COUNTIF(B2:B50,"<>")

or或者

=SUMPRODUCT(--(B2:B50<>""))

However, @JvdV formula is more appropriate.但是,@JvdV 公式更合适。 If you need to ignore formula blanks then the SUMPRODUCT formula can be used.如果您需要忽略公式空白,则可以使用SUMPRODUCT公式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM