Excel VBA - Year to Date validation - validation

I have a variable input in my Userform for the start of the Financial Year. I want to be able to validate the entry, so that it will prompt the user if the date entered is not the a start date for a financial year.
Eg.The start of my Financial year is 01 Jul 2012, so if I was running a report for the month's Jul 2012-Jun 2013 the Financial is entered will not come back with an error message. But if the monthly report I'm running is "Jul 2013", or "Aug 2013", and my YTD entered is "Jul 2012", I want an alert to say "Do you want to reset your YTD entered?"
Thanks.

There is a lot you aren't explaining... your first example is a 12-month report, then later you mention monthly reports. Using your example, if the monthly report is running starts Aug 2013. Is the user input that raises the prompt ALWAYS wrong, or only sometimes?
Regardless, things like the first day of the year don't change. Why not simply hardcode the first day of the last & next 20 (?) fiscal years, and verify the user's input matches one of them. I would actually suggest in-cell Data Validation (validating against a List comprised of the first days) but you stated you were using a UserForm.

Related

How to schedule monthly Trial Balance Report in NetSuite

I am trying to schedule monthly Trial Balance Report. For example, next 1 February 2023, I want to receive an email with the January 2023 Trial Balance report. Next 1 March 2023, I want to receive an email with the February 2023 Trial Balance report. Etc...
What is the configuration I have to set to do that?
Just setting the "End of" field to "Last Period" and creating the monthly schedule report (see screenshots)?
Any idea on how to do it?
Schedule Report Configuration
Trial Balance Report Configuration
As per your question ,I hope you want to receive monthly trial balance report(one month data).
You need to choose the Start Date as 1st Feb, 2023(Day before the chosen day of month) in schedule configuration.
And you can also add Date Created under filters section under the trial balance report configuration and choose it to last month.
I hope it will work.
Thanks,

Need to sample-testing a calendar application against invalid dates

I am testing a calendar application, which allows a user to select day, month and year, but the problem is the developers have not implemented any form of date validations, which means every month can have up to 31 days.
The year dropdown menu has a range from 1900 to 2016,
the month dropdown menu has Jan, Feb ... Dec,
the day dropdown menu always has 1~31, regardless of which month I choose.
The testing strategy I am thinking of is:
choose one non-leap year and test against 29th Feb; expected to fail
choose one non-leap year and test against 31st April; expected to fail
choose one leap year and test against 29th Feb; expected to succeed
choose one leap year and test against 31st April; expected to fail
Four scenarios above should provide a good coverage regarding leap years and invalid dates.
What are your opinions? Am I missing anything?

When building a report in BI SAP, how do I create a dynamic Task Finish Date filter that will change with each monthly report?

Specifically, if the report is scheduled for the 31st of every month, at 11:59 PM, I want the report to show data from that month.
Example: Report is run on Jan 31, 2016 11:59 PM. I would like the data to show everything with Task Finish Date from Jan 1, 2016 - Jan 31, 2016.
Thanks!
the simplest way is to create variable which will return for specified dates in cross table zero or one. Then set filter on it and show only 'ones'.
the solution you've provided is also simple - fistdayofmonth might be created by creating new date as year(run_date)+monthnumber(run_date)+"01"

How did windows/c# remember the current systems year/date

Recently i was working with unit testing for my project.
I've given a task to test the method. The method should return the recent quarter date as per the current system date.
So, I've called the current system date using the following c# code:
string currentYear = DateTime.Now.ToString();
When i run the query it worked as expected.
So, its time for my tactics to raise a bug for that method. Hence I've changed the system date to 10/01/14 (dd/mm/yy).
Also I've customized current system date format to only keep last two digits of the year.
Ex: if year is 2014 the it shows only 14.
You can observe the short date and the long date in the following image.
When i run/debug the test in Visual Studio 2012, it still displays as 2014 as the current system date though I've modified it to 14.
Question: The real question is how did the system/program took the current year as 2014 even the system date is changed to 14. It may be silly but my doubt is Why it is not 1914 or 1814 and why it is 2014 ?.
Where did it store the current date or year information ? Does windows manage this stuff or did the C# taken care of the date ?
The real question is how did the system/program took the current year as 2014 even the system date is changed to 14. It may be silly but my doubt is Why it is not 1904 or 1804 and why it is 2014 ?.
C# only retrieved the date from the system, it was Windows that determined what data to send.
In the case of two-digit dates, Windows allows you to define what they mean in the Regional and Language applet in the Control Panel. This way you can specify the range you want it to represent depending on your usage.
The display of a date is not how it is stored, just how it is displayed.
January, 1st, 2014 may have a multitude of different formats, e.g.
2014-01-01
01-01-2014
01-01-14
1/1/14
Jan/1/14
001-2014
But all are held internally exactly the same way.
Note the advanced settings on your screenshot - this will indicate to many windows programs how to interpret a year entered as 2 digits, so it knows if it should regard a date entered as XX as 19XX or 20XX - this will cover manually entered dates, not the system date
Your C# application didn't store that date, Windows handled it for you.
As Sean mentioned, by changing from YYYY to YY you only changed how the date is displayed, not how it is stored. Windows doesn't store its system time information into a specific date format. Instead, it records the number of 100-milisecond intervals since 00:00 January 1st, 1601. That way it keeps the tracking of time independent of how it's displayed and allows you to display the date and time in a number of different formats.
As a curiosity, that specific date was chosen because the Gregorian calendar operates on a 400-year cycle (when it starts to repeat itself) and 1601 was the first year of the cycle that was active when Windows NT was being developed.
On a side note, Unix systems store that information as Unix Time or POSIX Time, counting the number of seconds elapsed since 00:00 January 1st 1970.

How to change the starting date of a Calendar Year to something other than Jan 1st?

I'm writing an app that relies on the calendar and calendar events to display data to the user.
I need to be able to let the user select the beginning of his/her 'fiscal' year in settings, which will be the 1st of any of the 12 months. This is an app for military users, and any given unit's fiscal year can begin on whatever month their unit (base) decides.
The data I'm displaying to the user needs to be divided into 'fiscal' quarters according to the user's setting of the beginning of the fiscal year, not calendar year.
I'm not having problems retrieving, editing or deleting the events, I can't figure out how to change the beginning of the year to anything besides Jan 1st.
I found NSDateCategoryForReporting on GitHub, that seems like it's exactly what I need, but how do I tell it that the year begins on the 1st of x month?
iOS doesn't natively support this, so you'll have to find a plugin to do this or write your own. Your best bet is to write a class that performs the date conversions using the standard NSDate, NSCalendar, etc.
For instance, you could store what day the user specifies as their starting fiscal year. Then you can calculate the number of days difference between that and January 1st, and just shift dates based on that.

Resources