The range EquipmentID is, in this screen shot, F13:F18.
The contents of the cells in the A column is set by
Range("A" & Target.Rows(i).row) = "=COUNTIF(EquipmentID,F" & Target.Rows(i).row & ")"
There's a loop with an IF statement to see if B(i) is empty, if it is, it adds the COUNTIF() to A(i) and the hyperlink to B(i)
There's a loop with an IF statement to see if B(i) is empty, if it is, it adds the COUNTIF() to A(i) and the hyperlink to B(i)
If a duplicate is entered into a cell in the EquipmentID range, the code sees it and sets the offending cell to ""
The result is that the COUNTIF() in the corresponding A cell will show the sum of the one "" just entered and the ""
in the last cell of EquipmentID (F18)
In this case, I just highlighted the F16 cell and hit DELETE and it was still counted.
My understanding was that COUNTIF() isn't supposed to count spaces (or is it NULLs)
This is a spreadsheet that I was given to modify. I added the code to insert the COUNTIF() in the A column cells.
When I start with a new workbook and manually construct the table, the COUNTIF() statements work fine - they don't count the empty cells.
By the way, I did try Range("A" & Target.Rows(i).row) = "=COUNTIF(EquipmentID,F" & Target.Rows(i).row & ") - COUNTIF(EquipmentID,"""")"
In that case, the first COUNTIF() statement did not count the blank cells while the second one did, resulting in negative numbers.
Is there some kind of setting or statement that I should look for that could be telling the COUNTIF() function to count empty cells?