I cannot get too specific due to my company regulations, so I will attempt to provide as much info as I can. I have a for loop that goes through a list of names. In the loop, I have another loop that determines if a certain value should be assigned to to another list using the Name. Here is an Example John Doe is number one on my list. Jane Doe is number two.
John Doe
17:20 = 1
17:25 = 2
17:40 = 1
17:45 = 0
19:00 = 1
19:10 = 0
19:30 = 1
19:50 = 0
The Values are assigned based off of something that occurs during those times. If X happens, Add 1 to the value. If Z happens, subtract 1 from the value.
This will repeat for Jane Doe once the last row for John Doe is hit
(Everything above this I have already programed) Where I am stuck, is I need to be able to have excel Subtract the time with the value of 0, from the time with the value of 1
For Example
17:00 = 1
17:10 = 2
17:20 = 3
17:30 = 4
17:35 = 3
17:40 = 2
17:50 = 1
18:00 = 0
I need excel to be able to subtract 17:00 from 18:00 based off of the value on the right. I.e
If Range(B & [Whatever row]).Value = to 0 And Range(A & [Whatever row]).Value = 1 then
subtract Range(A & [Whatever row]) from Range(A & [Whatever row])
But the problem is when I doe this, it will subtract 17:50 from 18:00 due to it falling in the same circumstance. I fixed this through having ten different If else if circumstances, but I do not want to keep it that messy.
Does anyone have any other options?
I am fairly new to coding, so I am not too sure if there is anything else I can do other than that