ca.moazzam
Board Regular
- Joined
- Jan 2, 2011
- Messages
- 182
Hi friends
I have data (and a lot of it) on a sheet in the format given below (Data area). I have another sheet wherein some records of main data have been copied (like Supplier Code which repeats in some records in the Result sheet) and Date (which falls between "From" and "To" dates of that particular supplier). There is only one combination of supplier code and the required date (I mean all records are unique). I want my resuts sheet to first match the required Supplier Code in the Data Sheet (which is simple), then lookup the record of that supplier to find the row in which my result date falls between From and To dates. I have mentioned my required values in red below for ease of understanding.
I know that if I had a numeric value in the Case column, I could have used SUMIFS or SUMPRODUCT functions. But what to do in this case? May be some combination of INDEX/MATCH could work. Can anybody help me on this?
Thanks
Moazzam
[TABLE="width: 501"]
<tbody>[TR]
[TD]Data
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Supplier code
[/TD]
[TD]From date
[/TD]
[TD]To date
[/TD]
[TD]Case
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]111
[/TD]
[TD]1-Jan-10
[/TD]
[TD]31-Dec-10
[/TD]
[TD]A
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]111
[/TD]
[TD]1-Jan-11
[/TD]
[TD]31-Dec-11
[/TD]
[TD]B
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]112
[/TD]
[TD]1-Jan-10
[/TD]
[TD]31-Dec-10
[/TD]
[TD]C
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]112
[/TD]
[TD]1-Jan-11
[/TD]
[TD]31-Dec-11
[/TD]
[TD]D
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"]Result
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Supplier code
[/TD]
[TD]Date
[/TD]
[TD]Case
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]111
[/TD]
[TD]25-Jun-10
[/TD]
[TD]A (required)
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]112
[/TD]
[TD]1-Jul-11
[/TD]
[TD]D (required)
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I have data (and a lot of it) on a sheet in the format given below (Data area). I have another sheet wherein some records of main data have been copied (like Supplier Code which repeats in some records in the Result sheet) and Date (which falls between "From" and "To" dates of that particular supplier). There is only one combination of supplier code and the required date (I mean all records are unique). I want my resuts sheet to first match the required Supplier Code in the Data Sheet (which is simple), then lookup the record of that supplier to find the row in which my result date falls between From and To dates. I have mentioned my required values in red below for ease of understanding.
I know that if I had a numeric value in the Case column, I could have used SUMIFS or SUMPRODUCT functions. But what to do in this case? May be some combination of INDEX/MATCH could work. Can anybody help me on this?
Thanks
Moazzam
[TABLE="width: 501"]
<tbody>[TR]
[TD]Data
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Supplier code
[/TD]
[TD]From date
[/TD]
[TD]To date
[/TD]
[TD]Case
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]111
[/TD]
[TD]1-Jan-10
[/TD]
[TD]31-Dec-10
[/TD]
[TD]A
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]111
[/TD]
[TD]1-Jan-11
[/TD]
[TD]31-Dec-11
[/TD]
[TD]B
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]112
[/TD]
[TD]1-Jan-10
[/TD]
[TD]31-Dec-10
[/TD]
[TD]C
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]112
[/TD]
[TD]1-Jan-11
[/TD]
[TD]31-Dec-11
[/TD]
[TD]D
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"]Result
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Supplier code
[/TD]
[TD]Date
[/TD]
[TD]Case
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]111
[/TD]
[TD]25-Jun-10
[/TD]
[TD]A (required)
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]112
[/TD]
[TD]1-Jul-11
[/TD]
[TD]D (required)
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]