Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

Google Sheet countif only visible data using sumtotal

Sell / Buy
Buy
Buy
Sell

Hi all, I have google sheet that has a lot of Data However, i want to count number of "Buy" and "Sell" based on filtering the dates NOT the whole column ONLY VISIBLE rows

enter image description here

The code i'm trying to use is the below

=SUMPRODUCT(SUBTOTAL(9,OFFSET(E4,ROW(E4:E100)-ROW(E4),,1)),--(E4:E100 = "Buy"))

i'm really having bad time solving this issue, i would greatly appreciate if someone can help me with the code.

thank you.

question from:https://stackoverflow.com/questions/65642280/google-sheet-countif-only-visible-data-using-sumtotal

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

1 Answer

0 votes
by (71.8m points)

add column of SUBTOTAL

=SUBTOTAL(103, B4)

enter image description here

hide it:

enter image description here

then use:

=COUNTA(IFNA(FILTER(B4:B, C4:C="buy", D4:D=1)))

enter image description here

=COUNTIF(D4:D, 1)

enter image description here

="Buy: "&  COUNTIFS(C4:C, "buy",  D4:D, 1)&
 " Sell: "&COUNTIFS(C4:C, "sell", D4:D, 1)

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...