The formula tool allows you to write either text, numbers, dates, calculations, or functions in a column of data. This tool is useful for a wide range of things such as brief formatting dates, extracting certain text within a string, performing finance and math calculations, and even writing if statements. The output of these calculations can be written to a new column or an existing one. Let's start a new workflow by importing spreadsheet 2.6. We'll go to the Insert tab, drag in the input data tool and connects to the 2.6 spreadsheet. We have our example HR file again with 30 employees.
And I've got the date of birth column here that I'd like to reformat. I'd also like to extract the year from the title of joining and also want to write some logic to determine if an employee is entitled long service leave. In other words, they've been with the company for 10 or more years. Let's go to the preparation tab and drag in the formula tool into our workflow. In the configuration pane on the left, we're greeted with the option of assigning the output column, so one of the existing ones, or a new column, and also a list of functions that we can perform. For this video, we'll be using the date time, format function, the left function and the IF function.
Let's start by clicking in the formula tool and going to the functions icon and typing in date time format. We'll click on that and within daytime format there are two parameters DT and F TT is date. F is format So for dt, we'll replace that with date of birth in square brackets. And for F format, we actually need to refer to the online ultrix documentation. We need to use one of the following formats in this page. And because I want to say first month second and year last, we're going to use this format here.
So I'll copy this in and replace F. with double quotes and our new date format. Select a new column, we'll call this D or D. And we'll run our workflow. And we see our new Date of Birth column formatted as date, month and year. Now we're going to repeat the same steps to extract the year early from join date and calculate long service leave. So the last thing we want to calculate is Whether or not an employee is entitled to long service leave, so let's click on the Add icon, select a new column and call this long service leave. The function we want is the if conditions.
And we have three parameters here see to check the condition, T for the action of what happens when the condition is true, and F for false. If we start with C, the condition we want to check for is if the year joined, is less than or equal to 2009. And if that's true, then they are entitled for long service leave. If it's not true, then they are not entitled Because you joined is currently formatted as a string here, we need to convert the year joined here into a number. So let's prefix this with two number. And x is just the number we want to convert, so we'll leave it as you joined.
Open bracket and close bracket around here joined. If we don't do this, it'll result in error. Let's run our workflow and surely enough, we can see which employee is now entitled to long service. Leave.