I’m fairly certain that what I need to do is straightforward, but I have not been able to locate the necessary functions to accomplish it, and I appreciate everyone’s help in advance.
Simplified, I have a spreadsheet with three columns: Code, Overlap, and Total.
- Code is of the form G001, G002, … G160.
- Overlap is a boolean, determined by whether there is a particular overlap between the previous and current row.
- Total is a positive integer.
There can be anywhere from 1 to 15 entries for G001 through G160. The sheet is sorted, so that G001s are grouped (and ordered to ensure that Overlap is correctly calculated), then G002, etc.
On a different sheet, I have G001 through G160 in column A; the number matches the row (G001 is on row 1, G160 is on row 160). I would like to calculate the sum of all the “Totals” for each “Code”, substracting 1 per overlap=TRUE.
The answer would seem to involve VLOOKUP(), except that VLOOKUP() only returns a single match and not an array of matches. Since there is no way to do loops in functions, I cannot easily iterate VLOOKUP() searches using OFFSET() to shrink the array to be searched each time. Is there a way to retrieve all of the cell locations for a particular search term?
Thank you!