BeachBum
08-07-2016, 09:48 PM
Hi,
I have been working on a project comprised of several components. One part asks for a number of sessions from the user. The second part divides data in column A into these sessions. I have several repetitions in Column A but they have different dates, sessions and locations. What I want to find out is for each Item in Column A, how many sessions it appears in. For instance in the attached image, A appears 4 times and B appears twice. But A appears in 3 sessions on the 10th on Fleet St as per the attached image.
16815
I need to write this as a VBA program and my initial thinking was to have a loop similar to:
For each item in column A calculate the Max and min values appearing in column C.
If Max(C)-Min(C) = 0, then number of sessions = 1
If Max(C)-Min(C) = 1, then number of sessions = 2
If Max(C)-Min(C) = 2, then number of sessions = 3 etc (for an arbitrary number of sessions)
However this does not all for the same item on a different date or street.
Does anyone have any suggestions to make this happen? I feel like it should be something simple with a couple of for loops and if statements but I just cant quite get my head around it. The sources of information I have found, while useful, just don't quite seem to assist with the problem.
Thanks,
I have been working on a project comprised of several components. One part asks for a number of sessions from the user. The second part divides data in column A into these sessions. I have several repetitions in Column A but they have different dates, sessions and locations. What I want to find out is for each Item in Column A, how many sessions it appears in. For instance in the attached image, A appears 4 times and B appears twice. But A appears in 3 sessions on the 10th on Fleet St as per the attached image.
16815
I need to write this as a VBA program and my initial thinking was to have a loop similar to:
For each item in column A calculate the Max and min values appearing in column C.
If Max(C)-Min(C) = 0, then number of sessions = 1
If Max(C)-Min(C) = 1, then number of sessions = 2
If Max(C)-Min(C) = 2, then number of sessions = 3 etc (for an arbitrary number of sessions)
However this does not all for the same item on a different date or street.
Does anyone have any suggestions to make this happen? I feel like it should be something simple with a couple of for loops and if statements but I just cant quite get my head around it. The sources of information I have found, while useful, just don't quite seem to assist with the problem.
Thanks,