roscoe
Well-known Member
- Joined
- Jun 4, 2002
- Messages
- 1,046
- Office Version
- 365
- Platform
- Windows
- MacOS
Confusing title, I know, but couldn't think of a better one. I have a project of which I can't share any details (proprietary issues) for which I now have an odd requirement that I can't wrap my pea brain around.
I'll describe this best I can while staying vague. I need to look through a list for items that meet a certain criteria and (1) determine the total number of criteria-matching items, and (2) determine the total number of unique items. Analogy: I have a shopping cart with cans of food. I need the total of soup cans (i.e. 12 cans), and I need the total of soup flavors (i.e. 4 cans of tomato, 3 Chicken Noodle and 5 Clam Chowder equals a "flavor" count of 3).
I have no issue looping through the sheet and counting criteria-matching values, but I'm stumped at comparing each item to previous to assess whether to count it as a unique item or not. Manually I'd create a list of "flavors" and when I encounter another count of soup (Increment total by 1) I'd check the list to see if "Tomato" is on the list and if not add it. At the end I'd count the number of items in the "flavor" list. I just can't figure out the logic of this in a VBA loop.
Thanks in advance!
I'll describe this best I can while staying vague. I need to look through a list for items that meet a certain criteria and (1) determine the total number of criteria-matching items, and (2) determine the total number of unique items. Analogy: I have a shopping cart with cans of food. I need the total of soup cans (i.e. 12 cans), and I need the total of soup flavors (i.e. 4 cans of tomato, 3 Chicken Noodle and 5 Clam Chowder equals a "flavor" count of 3).
I have no issue looping through the sheet and counting criteria-matching values, but I'm stumped at comparing each item to previous to assess whether to count it as a unique item or not. Manually I'd create a list of "flavors" and when I encounter another count of soup (Increment total by 1) I'd check the list to see if "Tomato" is on the list and if not add it. At the end I'd count the number of items in the "flavor" list. I just can't figure out the logic of this in a VBA loop.
Thanks in advance!