TIME conversions in Microsoft Excel.
We’ve covered a lot of ground with posts on date calculations in Excel: using the DATEDIF function, calculations without the DATEDIF function , and in the most recent post – business day calculations with the NETWORKDAYS funtion. Now it’s turn to perform some TIME conversions and calculations in Excel. We will use TIME, TIMEVALUE, NOW, HOUR, MINUTE, SECOND, TEXT, and MOD functions to perform various time operations…
NOW function displays the current date and time. Depending on your cell formatting, it might be date only, or if your cell format is General, it could even be serial number equivalent of your current date and time. While this function has no arguments, its syntax still calls for a set of parenthesis: =NOW(). We already know that Excel uses the whole value of 1, in reference to the “beginning of time”, as far as Microsoft is concerned – January 1, 1900. Similarly, today’s date has the value of 42,124 The decimal point value references the fractional time portion of any date. As an example, 0.5 denotes NOON, while 0.75 refers to 6 PM. [0.75*24 = 18] Similarly, one minute, is 1/60th of an hour or 1/1440th of a day, calculating to be 0.069(4). Keep in mind that, whenever date/time value starts with a 0, the date portion has no value, and we are working with the time value only.
Performing business days calculations in Excel, with NETWORKDAYS function.
We already did some date calculations with a DATEDIF function, as well as without one . However, the limitation of both methods was the fact that they focused on calendar day calculations; in this post, we will perform business day calculations. To accomplish this task, we will need to use NETWORKDAYS, and possibly NETWORKDAYS.INTL functions.
Following our tradition, let’s turn to Microsoft’s own documentation to introduce the NETWORKDAYS function: “Returns the number of whole workdays between two dates using parameters to indicate which and how many days are weekend days. Weekend days and any days that are specified as holidays are not considered as workdays.”
Working with sample datasets in BigQuery
In the previous post we added public tables to our BigQuery interface. However, Google already provides sample data on various topics by default. While most of these tables are not updated, they still present some interest in terms of learning trends or insights on a multitude of topics. We will focus on 3 of these tables:
Natality (daily US births from 1969 to 2008),
GSOD (daily weather information by a station number from 1929 to 2009),
and Shakespeare (word index of Shakespeare’s works.)
Let’s start our exploration with the Natality dataset. The graph above charts share of teenager births, comparing to grand total by year. Between 1969, nominal number of births by teenagers went up from 307,561 to 441,110. However, this is not necessarily a bad news, considering growing US population. While in 1973, almost every fifth birth (19.55%) was by a teenager mother, by 2005 this ratio dropped to every 10th birth (10.18%.) To pull relevant source data, we simply need to run the following query (which would incidentally retrieve preteen births as well [outliers representing fewer than 200 births a year.]):
Getting started with Google BigQuery and GDELT Project
Once upon the time, the new kid on the block left more established search engines in the dust, then, after reinventing web-based email service, Google introduced its Apps. Today, let’s talk about one of the myriad services Google offers to us: BigQuery. Basically, this cloud-based service allows us to utilize Google’s hardware to store our own datasets or access public data on the go. Google provides API for Java, PHP, and Python access. In addition, various third-party tools now connect directly to BigQuery: Tableau, R, JasperSoft, and Simba to name a few. We get a 1 TB monthly usage quota to query BigQuery’s data for free. Some of the downsides of this service include: premiums for storing our own data and querying in excess of the free quota. We are also limited with data manipulation tasks we can perform in BigQuery; in fact, we can only append records to our table, we cannot update or delete them. Finally, this service uses a SQL language dialect, which lacks some of the SQL commands we are accustomed to: DISTINCT comes to mind, or resort us to some convoluted workarounds (try using the TOP command.) Meet, the GDELT Project – “the largest, most comprehensive, and highest resolution open database of human society ever created.” In this tutorial, we will learn some interesting facts about different countries, using GDELT data in BigQuery.