Lookup dates based from lookup values

agonysWeeper

Board Regular
Joined
Feb 4, 2011
Messages
146
Hi-

Got this setup and trying to figure a better formula to get the correct results.
I wanted to run a lookup formula in Column C based from column B value (dates), formula must also rely in column A value which is quarters, I'm trying to run an IF and a lookup formula but since there are a lot of quarters, this seems not good.

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Column A[/TD]
[TD]Column B[/TD]
[TD]Column C[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]18Q1[/TD]
[TD]3/1/2015[/TD]
[TD][/TD]
[TD]*result must be last Qtr[/TD]
[/TR]
[TR]
[TD]16Q1[/TD]
[TD]11/6/2014[/TD]
[TD][/TD]
[TD]*result must be last Qtr[/TD]
[/TR]
[TR]
[TD]12Q4[/TD]
[TD]6/3/2017[/TD]
[TD][/TD]
[TD]*result must be Next Qtr[/TD]
[/TR]
[TR]
[TD]17Q1[/TD]
[TD]2/2/2017[/TD]
[TD][/TD]
[TD]*result must be This Qtr[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

and the Quarters has 3 dates category something like these.
18Q1
1/1/1900 - Last Qtr
1/1/2018 - This Qtr
4/1/2018 - Next Qtr
18Q2
1/1/1900 - Last Qtr
4/1/2018 - This Qtr
7/1/2018 - Next Qtr
and soon.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hi agonysWeeper,
If I get your example, you're trying to see if the date in column B is in the quarter in column A, right? If so, you'd first have to transform your column A into a date, e.g. like so:

=DATE(2000+LEFT(A2,2),RIGHT(A2,1)*3-2,1) -> first day of the quarter
=DATE(2000+LEFT(A2,2),RIGHT(A2,1)*3+1,0) -> last day of the quarter

Next, compare them in a double IF function:

=IF(B2 < DATE(2000+LEFT(A2,2),RIGHT(A2,1)*3-2,1),"last", IF(M14 > DATE(2000+LEFT(A2,2),RIGHT(A2,1)*3+1,0),"next","this"))


Hope that helps,

Koen
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

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