Calc: IF tests inconsistently

I’ve searched for similar issues, but I haven’t found them. In fairness, I’m not sure what I would search for to find it, so if someone has a post that already answers this question I’m sorry for being poor at searching.

The problem: Identical IFs searching identical cells simultaneously produce different results.

Description: H2 through H20 are a series of VLOOKUPs, many with additional conditionals within the VLOOKUP. They all appear to be functioning properly. They are handling only text.

H21 reads as follows: =IF(COUNTIF($H$2:$H$20,"=Station"),“Atelier”,“None”)

H22 reads as follows: =IF(COUNTIF($H$2:$H$20,"=Station"),“Habitat”,“None”)

H23 reads as follows: =IF(COUNTIF($H$2:$H$20,"=Station"),“Reclamation”,“None”)

If “Station” is present, then all three put out their “then” values (“Atelier”, “Habitat”, and “Reclamation”). However, if “Station” is not present, then H21 outputs “Atelier” while H22:H23 put “None”.

Things I’ve Tried: I’ve tested several permutations - I’ve arranged the automation so that “Atelier” does not appear anywhere within H2:H20 (thinking that the following “Atelier” might be tripping the system), I’ve added “Station” to H2:H20 (which causes all three to display their “then” values) and then removed it (H21 still reads “Atelier”), etc. I’ve also scanned every cell H2:H20, and not a one of the statements within them contains “Station” at any point.

System: Running on Linux Mint 17.2, the version of LibreOffice that came with it. I have a rather complicated spreadsheet (mostly automation), and I’m getting a particularly odd erroneous result.

Thank you for your time and attention. This is an oddball one, and it’s making my head hurt.

Naturally, I resolved it the moment I asked the question, and now I feel like an idiot.

Solution: Revise the COUNTIF statements to expressly read “>0” afterwards, so that it’s specifically checking for >0 rather than generating a truth value.

I still have no idea why that matters, and that’s something the developers might be interested to know. However, I’m very sorry for having needlessly occupied space. Thank you.