Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
950 views
in Technique[技术] by (71.8m points)

excel - How do I only count visible rows when using the COUNTIFS function?

I've been using Excel's COUNTIFS function to count the number of rows in a table that meet certain criteria, E.g:

=COUNTIFS(Table1[Result],"Fail", Table1[Comments], "")

Now I want to modify this expression so that it only counts rows in Table1 that are visible. (I.E. Not filtered out.) How can I accomplish this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Simple way is to add another column to table - e.g. called helper with a formula like this

=SUBTOTAL(103, B2)

where column B is Result column

Now change formula to

=COUNTIFS(Table1[Result],"Fail", Table1[Comments], "",Table1[Helper],1)

the subtotal formula only returns 1 on visible rows

Without a helper column you can use this formula

=SUMPRODUCT((Table1[Result]="Fail")*(Table1[Comments]=""),SUBTOTAL(103,OFFSET(Table1[Result],ROW(Table1[Result])-MIN(ROW(Table1[Result])),0,1,1)))


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...