开发者

How to compare literals in COUNTIF

开发者 https://www.devze.com 2022-12-18 20:27 出处:网络
Named lists in an excel sheet are referenced from another sheet on the same book. E.g. Sheet 2 has the named lists(GRPCNT) contain strings

Named lists in an excel sheet are referenced from another sheet on the same book.

E.g.

Sheet 2 has the named lists(GRPCNT) contain strings

> 5
5 - 9
10 - 20
> 20

Sheet 1 uses GRPCNT to provide a list of options. Say, there are three rows

A | > 5
B | > 20
C | > 5

Sheet 1 has to determine the number of occurrences of each option from the list.

The problem is

COUNTIF(Range, "> 5") 

returns '0' instead of '2' for the example data above.

I need a literal comparision something along the lines 开发者_如何学Goof

COUNTIF( Range, Sheet2!A1 ) , or 
COUNTIF( Range, "'> 5'" )

Both above attempts failed to provide the desired result.

What am I doing wrong here?


COUNTIF(Range, "=> 5")

This count how many cells in the range matches (=) the content > 5 (no "=>" is not an operator).

The equal sign is needed because > at the start already has a special meaning: count cells which integer values is greater than 5.

0

精彩评论

暂无评论...
验证码 换一张
取 消