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
218 views
in Technique[技术] by (71.8m points)

excel - How do I use IF formulas to display blanks or 0's dependent on data in other columns?

I am trying to get rows within column G in sheet STATISTICS to populate a 0 if there is no L's to count in column P on sheet TRADE LOG.

However, if there are any L's present in column P in sheet TRADE LOG then I would like these counted and a value displayed in the rows of column G on sheet STATISTICS.

The issue is that despite COUNTIF naturally producing a 0I do not want a 0 present if there is NO data in the rows of column E on sheet STATISTICS

My current formula is as below:

=COUNTIFS('TRADE LOG'!P:P,"L",'TRADE LOG'!B:B,">="&DATE(2021,2,1),'TRADE LOG'!B:B,"<="&DATE(2021,2,28))

This is also all to be done within a date range as seen in the formula.

Could anyone suggest how I can achieve this? (VBA suggestions welcomed by if can be avoided then great)

question from:https://stackoverflow.com/questions/66050607/how-do-i-use-if-formulas-to-display-blanks-or-0s-dependent-on-data-in-other-col

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

1 Reply

0 votes
by (71.8m points)

Give this a try:

=if(COUNTIFS('TRADE LOG'!P:P,"L",'TRADE LOG'!B:B,">="&DATE(2021,2,1),'TRADE LOG'!B:B,"<="&DATE(2021,2,28))=0,"",COUNTIFS('TRADE LOG'!P:P,"L",'TRADE LOG'!B:B,">="&DATE(2021,2,1),'TRADE LOG'!B:B,"<="&DATE(2021,2,28)))

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

...