Home>

Is there a method like countif in Python's win32com/pywin32?

maxr = dtrange.Rows.Count


Come and

sheet.Range ("L2: L" + str (rows))


I want to take some alert action when there is at least one cell in this L column that contains a specific character (eg "mandarin").

If i use a for loop, you will take action every time you discover a "mandarin orange".
Say
sheet.Range ("L2: L" + str (rows))
When you print ((apple,), (apple,), (mandarin orange,))
type is
It seems that it is not a list type.
this
"Alert if countif is<>0"
How can I make it feel like that?

  • Answer # 1

    Basically, I think that it will work by turning it with a for statement to get the state of each cell.

    If it's a loop for that purpose, you can find'Mikan'and alert it, then break it with break.

    If you want to run the loop for other purposes, set a flag or counter, check it after the loop ends, and issue an alert.

    Isn't it okay?