Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

Begin and End Dates

Hi:

Attached is an Excel spreadsheet with a column of dates.

I need a formula for the “Begin Period”, similar to the one I have in the spreadsheet for the “End Period”. The “Begin Period” is based on the column of dates and is at the bottom of the column, but that column varies with number of dates and rows each time the report is run.  

I need the result in the format, for example, "December, 2010"

Keep in mind the column of dates will always be a different number of rows. In one reporting period there may be 50 rows of dates, in others it may be 200 rows of dates. The first row will always be fixed but the last row, obviously, will always be different based on the varying number of dates.

Currently, for the "End Period" formula I have, and it works:

=TEXT(DATEVALUE(LEFT(A4,3)&" " &MID(A4,FIND(" @",A4)-4,4)),"mmmm, yyyy")

I just need the Begin Period formula for the month & year, but am not sure how to do this with varying numbers of rows of dates.

Thank you!

 Dates-2.xlsx
0
Tim Jackoboice
Asked:
Tim Jackoboice
  • 5
  • 4
  • 3
1 Solution
 
nutschCommented:
Here is an array formula for that, to be entered with Ctrl+Shift+Enter
=INDEX(A:A,MAX(IF(LEN(A:A)>0,ROW(A:A),0)))

Thomas
0
 
Tim JackoboiceOwnerAuthor Commented:
Nutsch:

I'd rather not use arrays, due to the fact the number of rows of dates will constantly be changing. Is there a way to do this without using an array?  Thanks.
0
 
nutschCommented:
>due to the fact the number of rows of dates will constantly be changing

why is that an issue with array formulas since you're looking at the whole column anyway?

Thomas
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Tim JackoboiceOwnerAuthor Commented:
... plus, it only returns #VALUE! when entered into cell B1 on the example spreadsheet and adjusted to begin at cell A4 (the beginning of the column of dates.)
0
 
nutschCommented:
I insist on
=TEXT(DATEVALUE(LEFT(INDEX(A:A,MAX(IF(LEN(A:A)>0,ROW(A:A),0))),12)),"MMMM, YYY")

as in your attached, updated sample file.

What part doesn't fit?

T


Copy-of-Dates-2.xlsx
0
 
nutschCommented:
Warning, the formula will return #VALUE if it's validated as a standard formula, ie with Enter. You need to enter the cell (using F2) and validate with Ctrl+Shift+Enter to have it work as an array formula. When you do this, you will see {} appear around the formula in the formula box.

Thomas
0
 
barry houdiniCommented:
Assuming that you only have those dates in column A then you can use this non-array version

=TEXT(LEFT(LOOKUP("zzz",A:A),12),"mmmm, yyyy")

regards, barry
0
 
barry houdiniCommented:
...similarly you can simplify the end date formula to just

=TEXT(LEFT(A4,12),"mmmm, yyyy")

regards, barry
0
 
Tim JackoboiceOwnerAuthor Commented:
Nutsh and Barry:

The array formula Nutsch offered did in fact work ... I had to change a bit of the formula as my example sheet was just a subset of my larger spreadsheet. I would like to use non-array formulas, simply because I'm not familiar with arrays and was under the impression I had to change them often when the number of cells, rows, columns etc changed. Using the Begin Date, non-array formula in my larger spreadsheet, I got FALSE as a return, but the simplified end date formula did work. Am I missing something with the Begin Date? Is "zzz" exactly what I should enter?  In my larger spreadsheet, all the dates begin in cell B9 and run down the column, with no other type of entries within the column.Again, the number of rows and dates varies, but nothing else but those dates are entered from cell B9 down. Thanks.
0
 
barry houdiniCommented:
As your "dates" are actually text the LOOKUP formula is appropriate because it should find the last text value in a column, so for your last date in column B you can use

=LOOKUP("zzz",B:B)

Exactly like that - does that give you the last date in column B?

Then you can extract the first 12 characters using

=LEFT(LOOKUP("zzz",B:B),12)

and finally TEXT function gives you the format you want, i.e.

=TEXT(LEFT(LOOKUP("zzz",B:B),12),"mmmm, yyyy")

That works for me in your sample file - applied to column A and with other data removed

regards, barry

0
 
nutschCommented:
barry's solution worked for me too.

T
0
 
Tim JackoboiceOwnerAuthor Commented:
Guys -- Thank you so much. Works perfectly. I had copied the formula incorrectly and that was apparently the problem. Nutsch, thank you so much for your help, but with my unfamiliarity with arrays I'm more comfortable with Barry's non-array formula, and thank you Barry for explaining it in detail as you did.

Have a great week, and thanks to you both again!!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now