Pre-read note: I'm using LibreOffice rather than Excel, but most functions should apply to both.
I'm making a spreadsheet where I have a bunch of data, and for every property (such as # of employees or a name) I need a function that calculates how many rows contain each distinct value.
I already have the distinct values extracted, and now I'm using the following function to calculate how many rows have each value: =COUNTIF(start:end;value)
. (Note that the semicolon is LibreOffice's way of separating parameters, as opposed to Excel's comma.)
Now, my problem is that I have some rows that can have values such as "< 50". Using the COUNTIF
function, it seems that the '<' is treated as a 'less than' operator, rather than as a text character. Therefore, if the cell I'm trying to match the column against has the value "< 50", I end up with a value 0 as result of the formula. How can I get the COUNTIF
to treat the less-than sign as a text character? Or is there another function I should use here?
=COUNTIF(A:A,"=< 50")
Works for me in Excel 2007
In Excel you could use SUMPRODUCT, i.e.
=SUMPRODUCT((start:end=value)+0)
The direct comparison using = will do an exact comparison and isn't confused by < or > like COUNTIF
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With