How to use the Index and Match function to lookup up values in a non traditional table

I want to use the data set to lookup the items associated by month. At any given month, I want to lookup the values for the revenue and expenses per ID. The IDs are listed above but they are located in merge cells. This creates a problem because typically tables do not have merge cells. But with using the index and match function I can lookup the data I want. I will need to create 3 range names. One for the data range, one for the horizontal labels, and the other for the vertical labels. The index function has 3 arguments. First I use the data range, then I need a row number to go [...]