I think there may be a disconnect (or missing details) between the question you posted, and what you are really trying to do, because I thought I knew what you were asking for, but your last post now makes me question that.
I think it would be better to take a different approach here. Show us an example of your data AND your expected results based on that data, and explain the logic, if necessary. Then we are not trying to guess as to what you are ultimately trying to accomplish.
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here:
XL2BB Add-in
Note that there is also a "
Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.