vendredi 19 juillet 2019

Using if function to count

I am trying to use an if function to count how many items an item is populated in my data set. I think my problem is I can't get my iteration or my range correct but I cant figure out what I'm doing wrong.

If I was to write out what I am trying to do: if column L = VARX THEN print the number of varX in that range

cell_range = ws['L1:L10']
row_count=ws.max_row
for i in range(13, row_count):
    for cell in cell_range:
        if cell.value == 'VARX':
            print(tuple.count())

Error I get: tuple' object has no attribute 'value' I understand the value error is because i am trying to use cell.value but not sure what else to do

Aucun commentaire:

Enregistrer un commentaire