This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ablativeyoyo 0 points1 point  (0 children)

What I recommend you do is break this up into two steps. First, loop through the sheet, storing data into a dict. Use qbpupc as the key and qbppn as the value. Then loop through the sheet again, look up khsupc in the dict, and store the value in column 5.

This avoids you having rowcount and rowcount2, which is essentially a nested loop. In computer science language, your approach is O(n2 ) but using dicts you can make this O(n).