Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Create Excel Worksheet Function

Posted on 2011-09-30
4
Medium Priority
?
219 Views
Last Modified: 2012-05-12
Hi Experts,

The company I work for uses a 4 week fiscal period and I would like to see if it would be possible to create a worksheet funtion that would retunr the fiscal period based on the datevalue entered.  Similar to the month function returning the number of the month of the datevalue.  The function would be =Period(datevalue)

The conditions and results for 2011 would look like this:

Between 12/27/10 and 01/23/11 ----->   01/11
Between 01/24/11 and 02/20/11 ----->   02/11
Between 02/21/11 and 03/20/11 ----->   03/11
Between 03/21/11 and 04/17/11 ----->   04/11
Between 04/18/11 and 05/15/11 ----->   05/11
Between 05/16/11 and 06/12/11 ----->   06/11
Between 06/13/11 and 07/10/11 ----->   07/11
Between 07/11/11 and 08/07/11 ----->   08/11
Between 08/08/11 and 09/04/11 ----->   09/11
Between 09/05/11 and 10/02/11 ----->   10/11
Between 10/03/11 and 10/30/11 ----->   11/11
Between 10/31/11 and 11/27/11 ----->   12/11
Between 11/28/11 and 12/25/11 ----->   13/11

The result would return as a string.

Any suggestions if this is possible and how it would be created?

Thanks

JJ
0
Comment
Question by:JJINFM
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 19

Expert Comment

by:Arno Koster
ID: 36891977
you could use the weeknumber formula for this :

=TEXT(1+FLOOR((B2-$B$1)/28,1), "0#") & "/" & TEXT(B2,"YY")

Open in new window


startdate 12/27/10 should be in cell B1 and the date for which the formula work then should be placed in cell B2.
You can drag the formula downwards to compute fiscal periods for cells B3, B4, B5 etc
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 36892007
If you create a table with the start date of each period in one column and the period name for each(like 09/11) in the other then you can use a simple LOOKUP, e.g. with table in Y2:Z20 use this formu;a

=LOOKUP(A2,$Y$2:$Z$20)

where your date is in A2

otherwise, without a table you can use this formula

=TEXT(INT((A2-DATE(2010,12,27))/28)+1,"00")&"/11"

regards, barry
0
 
LVL 81

Accepted Solution

by:
byundt earned 2000 total points
ID: 36892127
Here is a user-defined function that should work for any year after 1999:

Function Period(dateValue As Date) As String
Period = Format((Int((dateValue - 23) / 28) - 4) Mod 13 + 1, "00/") & Format(Int((dateValue - 135) / 364) - 100, "00")
End Function

Open in new window


Install this code in a regular module sheet and use it with a worksheet formula like:
=Period(A3)                   assuming A3 contains a date
0
 

Author Closing Comment

by:JJINFM
ID: 36892336
Thank you.  This is what I was looking for.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question