Forestq

Active Member
Joined
May 9, 2010
Messages
482
Hi,

I have below table1 (sheet1):
StartDate(A1)

<tbody>
</tbody>
EndDate(B1)

<tbody>
</tbody>
Month(C1)Quater(D1)Year(E1)
29/07/2012

<tbody>
</tbody>
25/08/2012

<tbody>
</tbody>
1Q1
2013

<tbody>
</tbody>
26/08/2012

<tbody>
</tbody>
22/09/2012

<tbody>
</tbody>
2Q1
2013

<tbody>
</tbody>
23/09/2012

<tbody>
</tbody>
27/10/2012

<tbody>
</tbody>
3Q1
2013

<tbody>
</tbody>
28/10/2012

<tbody>
</tbody>
24/11/2012

<tbody>
</tbody>
4Q2
2013

<tbody>
</tbody>
25/11/2012

<tbody>
</tbody>
22/12/2012

<tbody>
</tbody>
5Q2
2013

<tbody>
</tbody>
23/12/2012

<tbody>
</tbody>
26/01/2013

<tbody>
</tbody>
6Q2
2013

<tbody>
</tbody>
27/01/2013

<tbody>
</tbody>
23/02/2013

<tbody>
</tbody>
7Q3
2013

<tbody>
</tbody>
24/02/2013

<tbody>
</tbody>
23/03/2013

<tbody>
</tbody>
8Q3
2013

<tbody>
</tbody>
..........

<tbody>
</tbody>

Table is filled in this way till 2017.
Now into tab "sheet2" into col A, I have dates:

Dates(A1)Month (B1)
24/08/20121
25/09/20123
20/12/20125
01/11/20136
03/10/20123

<tbody>
</tbody>

How to add month value based on table1?

I don't want to do a lot of if....is other way? How to write simple function to fill month based on table1?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
You're welcome.

The only issues you might have with it is when the given date is before the earliest date in column A (29/07/2012), or after the latest date in column B (23/03/2013)

Here's an ammendment to handle those issues.
=IF(Sheet2!A2>Sheet1!B$9,"Date is later",IFERROR(LOOKUP(Sheet2!A2,Sheet1!A$2:C$9),"Date is earlier"))
 
Last edited:
Upvote 0
ok, thanks

I did:
=IFERROR(LOOKUP(Sheet2!A2,Sheet1!A$2:C$61),"")

but i think my function not eliminate issue as your code.
 
Upvote 0
The iferror will only eliminate the error when Sheet2!A2 is before the earliest date (Sheet1!A2)

And you've expanded it to 60 rows.
Is the pattern still the same, and are there any blank rows in that 60 rows?
Blanks in Sheet1 column A can cause problems.
 
Upvote 0
Should be fine then

=IF(Sheet2!A2>Sheet1!B$61,"",IFERROR(LOOKUP(Sheet2!A2,Sheet1!A$2:C$61),""))
 
Upvote 0

Forum statistics

Threads
1,214,377
Messages
6,119,183
Members
448,872
Latest member
lcaw

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