PDA

View Full Version : logic operator bug, I've never had anything like this



markusf1895
09-19-2019, 01:37 AM
Hello everone,

i want to Count Frequencies of the measured values in areas.

When he should write in Row 55 für the Value 0.2,
he over jump this if-case:


If sheet.Cells(ReadRow, ZSwrite(1)) <= sheet.Cells(WriteRow, ZSwrite(1)) Then
holderForMyself = sheet.Cells(WriteRow, WriteReadColumn + 1)
sheet.Cells(WriteRow, WriteReadColumn + 1) = CInt(sheet.Cells(ReadRow, WriteReadColumn + 1)) + holderForMyself
End If


While the left and Right side in the if-condition is the same, he over pass the if-case.

Hope you know where the error comes from.

25113

arangogs
09-19-2019, 04:19 AM
Hi Markusf1895,

Not totally sure what you are looking to do. I think you are expecting to write to row 55 as it matches row 21 of 0.2?

I suspect the value in the cell is likely not matching on the decimal Nth point.

you could use round\floor function to match the data
round(sheet.Cells(ReadRow, ZSwrite(1)),4) <= round(sheet.Cells(WriteRow, ZSwrite(1)),4)

markusf1895
09-19-2019, 11:33 PM
Perfect, this is the solution.��