Returning a date from a range

pbyrne462

New Member
Joined
Apr 13, 2011
Messages
17
I have a set of three criteria, Product, Country, Date

My data appears like this:

Product 1 Country 1 01JAN11
Product 2 Country 2 01APR11
Product 3 Country 3 01JUL11
Product 4 Country 4 01OCT11

I have a seperate table which I want to sequence the countries depending on the quarters, so I have 4 columns. I need to look at the table above speficically the dates and return them in sequence depending on if they are in quarter 1 to 4. So following the example above I would have a resulting table that contains Country 1 in Q1, Country 2 in Q2 etc.

Hope this makes sense and I hope someone can help.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Do you have a single value per quarter?

Are your dates real Excel dates ( they look like strings to me )?

Does your output ( where you want the output ) have a specific layout with specific headings that are to be used in the calculations?
 
Upvote 0
No I could have multiple values per quarter, I need to pick all that apply to the Quarter and return then in date order.

they are real excel dates, I just wrote them out that way.

The layout does not have headings but I could construct some and hide them if that will help with the calculations?
 
Upvote 0
Is the source data going to be in date order?

Can I ask what you are going to be doing with the data after it's been split into quarters? And why do you want this? I would have thought a PivotTable of the data grouping the date by quarter would have been much much more useful.
 
Last edited:
Upvote 0
the source data will be in date order yes.

The end aim is to build a picture of which countries go in which quarter. the format is quite specific for the audience that is why I can't use a pivot table
 
Upvote 0
If the format is quite specific then post it here.
 
Upvote 0
I am unable to post attachments. I need the following submission dates to be represented on graph that has Quarters along the bottom and the Countries stacked above the quarter depending on the submission date.

<TABLE style="WIDTH: 170pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=226 border=0><COLGROUP><COL style="WIDTH: 48pt" width=64><COL style="WIDTH: 65pt; mso-width-source: userset; mso-width-alt: 3145" width=86><COL style="WIDTH: 57pt; mso-width-source: userset; mso-width-alt: 2779" width=76><TBODY><TR style="HEIGHT: 15pt" height=20><TD class=xl64 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; WIDTH: 48pt; BORDER-BOTTOM: #f0f0f0; HEIGHT: 15pt; BACKGROUND-COLOR: white" width=64 height=20>Product</TD><TD class=xl64 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; WIDTH: 65pt; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: white" width=86>Country</TD><TD class=xl65 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; WIDTH: 57pt; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: white" width=76>Submission</TD></TR><TR style="HEIGHT: 15pt" height=20><TD class=xl64 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; HEIGHT: 15pt; BACKGROUND-COLOR: white" height=20>Product 1</TD><TD class=xl64 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: white">Country 1</TD><TD class=xl65 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: white">20-Jan-11</TD></TR><TR style="HEIGHT: 15pt" height=20><TD class=xl64 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; HEIGHT: 15pt; BACKGROUND-COLOR: white" height=20>Product 2</TD><TD class=xl64 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: white">Country 2</TD><TD class=xl65 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: white">9-Feb-11</TD></TR><TR style="HEIGHT: 15pt" height=20><TD class=xl64 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; HEIGHT: 15pt; BACKGROUND-COLOR: white" height=20>Product 3</TD><TD class=xl64 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: white">Country 3</TD><TD class=xl65 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: white">23-Feb-11</TD></TR><TR style="HEIGHT: 15pt" height=20><TD class=xl64 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; HEIGHT: 15pt; BACKGROUND-COLOR: white" height=20>Product 4</TD><TD class=xl64 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: white">Country 4</TD><TD class=xl65 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: white">10-Mar-11</TD></TR><TR style="HEIGHT: 15pt" height=20><TD class=xl64 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; HEIGHT: 15pt; BACKGROUND-COLOR: white" height=20>Product 5</TD><TD class=xl64 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: white">Country 5</TD><TD class=xl65 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: white">15-Apr-11</TD></TR><TR style="HEIGHT: 15pt" height=20><TD class=xl64 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; HEIGHT: 15pt; BACKGROUND-COLOR: white" height=20>Product 6</TD><TD class=xl64 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: white">Country 6</TD><TD class=xl65 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: white">23-Aug-11</TD></TR><TR style="HEIGHT: 15pt" height=20><TD class=xl64 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; HEIGHT: 15pt; BACKGROUND-COLOR: white" height=20>Product 7</TD><TD class=xl64 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: white">Country 7</TD><TD class=xl65 style="BORDER-RIGHT: #f0f0f0; BORDER-TOP: #f0f0f0; BORDER-LEFT: #f0f0f0; BORDER-BOTTOM: #f0f0f0; BACKGROUND-COLOR: white">14-Dec-11</TD></TR></TBODY></TABLE>
 
Upvote 0
Look at this example, and see if it makes sense to you:

Excel Workbook
ABCDEFGH
1ProductCountrySubmissionQtrQ4
2Product 1Country 101-Jan-11Q1ProductCountrySubmission
3Product 5Country 502-Jan-11Q1Product 11Country 1101-Oct-11
4Product 9Country 904-Jan-11Q1Product 4Country 402-Oct-11
5Product 33Country 3302-Feb-11Q1Product 8Country 803-Nov-11
6Product 6Country 601-Apr-11Q2Product 12Country 1221-Dec-11
7Product 10Country 1005-Apr-11Q2   
8Product 3Country 301-Jul-11Q3
9Product 44Country 3402-Jul-11Q3
10Product 7Country 703-Jul-11Q3
11Product 11Country 1101-Oct-11Q4
12Product 4Country 402-Oct-11Q4
13Product 8Country 803-Nov-11Q4
14Product 12Country 1221-Dec-11Q4
Sheet38
 
Upvote 0
Thanks I can now get the Quarters to work but when I try to use the formula

=IF(ROW()-ROW($F$2)<=COUNTIF($D$2:$D$14,$F$1),INDEX(A$2:A$14,MATCH($F$1,$D$2:$D$14,0)+ROW()-ROW($F$2)-1),"")

it returns a #VALUE, so I am missing soemthing, could you explain the ROW()-ROW($F$2) part and +ROW()-ROW($F$2)-1. I think its nearly what I need I just need to understand how it works to apply it to my cells.
 
Upvote 0
Thanks I can now get the Quarters to work but when I try to use the formula

=IF(ROW()-ROW($F$2)<=COUNTIF($D$2:$D$14,$F$1),INDEX(A$2:A$14,MATCH($F$1,$D$2:$D$14,0)+ROW()-ROW($F$2)-1),"")

it returns a #VALUE, so I am missing soemthing, could you explain the ROW()-ROW($F$2) part and +ROW()-ROW($F$2)-1. I think its nearly what I need I just need to understand how it works to apply it to my cells.
Using ROW()-ROW(...) makes the formula dependent on what row the formula is entered on.

Using ROWS is more robust.

=IF(ROWS(F$3:F3)>COUNTIF($D$2:$D$14,$F$1),"",INDEX(A$2:A$14,MATCH($F$1,$D$2:$D$14,0)+ROWS(F$3:F3)-1))
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,844
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top