0

Checking in SELECT results are not null

Hi,

I'm trying to check if the result of a Select has any item or returns 0 items. 

IF(AVERAGE(SELECT(@April,P:P; * 0.01, @April,K:K; = "1%")) !=BLANK(), AVERAGE(SELECT@April,P:P; * 0.01, @April,K:K; = "1%"), 0)

If the Average function returns no item with my condition, I want to return "0" value.

But I don't know how to compare the result in order to know if there are items or not. IF functions ALWAYS returns me 0 items,

 

Anybody knows how to get this working?

Regards,

Thanks in advance

1 comment

  • 0
    Avatar
    Janice Janczyn

    Hi there! 

    Thank you for posting in our community.

    Instead of SELECTing the items, I would use the COUNTIF function to count how many items return true for your condition. Then I would use the AVERAGEIF function to get the average of the values in column P that match your condition:

         IF( COUNTIF( @April,K:K; = "1%") > 0,
              AVERAGEIF (@April,K:K; = "1%", @April,P:P;  ) * 0.01,
              0 )

    I hope this helps,
                        Janice

Please sign in to leave a comment.