Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,250 --> 00:00:03,030
Hey, welcome back.
2
00:00:03,030 --> 00:00:06,849
So far we've worked with strings in
both SQL and spreadsheets before, and
3
00:00:06,849 --> 00:00:10,360
we've learned that they usually
have similar functions.
4
00:00:10,360 --> 00:00:15,280
In this video, we'll take another
look at LEN, LEFT, RIGHT and FIND.
5
00:00:16,280 --> 00:00:18,808
You've come across these
functions used in SQL, but
6
00:00:18,808 --> 00:00:21,610
now you'll find out how
they work in spreadsheets.
7
00:00:21,610 --> 00:00:24,150
Going back to our bike sharing dataset,
8
00:00:24,150 --> 00:00:26,700
let's check out one of their spreadsheets.
9
00:00:26,700 --> 00:00:29,560
This is one of the Trip Data spreadsheets.
10
00:00:29,560 --> 00:00:32,159
In the starttime and stoptime columns,
11
00:00:32,159 --> 00:00:37,215
there are strings that contain information
about date and time of each ride.
12
00:00:38,545 --> 00:00:41,658
This is all useful data,
but chances are we'll only
13
00:00:41,658 --> 00:00:46,295
need part of the strings to make
a formula or answer a question.
14
00:00:46,295 --> 00:00:51,715
For example, these strings contain
multiple data points, like date and time.
15
00:00:51,715 --> 00:00:54,888
But if we're trying to find
the average time between start times,
16
00:00:54,888 --> 00:00:56,550
we won't need the date.
17
00:00:56,550 --> 00:00:59,347
We can actually use LEN,
LEFT and RIGHT, and
18
00:00:59,347 --> 00:01:04,320
FIND to split the timestamps into
separate columns if we want.
19
00:01:04,320 --> 00:01:08,310
Let's build a simple formula to
separate the dates in these strings.
20
00:01:08,310 --> 00:01:12,020
We know that LEN tells us
the length of a string.
21
00:01:12,020 --> 00:01:15,670
Let's check how long these
datetime strings are now.
22
00:01:15,670 --> 00:01:18,000
To start,
we'll input the first part of the formula.
23
00:01:19,800 --> 00:01:24,820
And then we'll just select one of
the cells with the datetime string in it.
24
00:01:24,820 --> 00:01:27,700
These strings are 19 characters long.
25
00:01:27,700 --> 00:01:32,330
We can use the FIND function to locate
specific characters in a string.
26
00:01:32,330 --> 00:01:34,710
Keep in mind, this is case-sensitive.
27
00:01:34,710 --> 00:01:37,030
So if you're using FIND
to pull a substring,
28
00:01:37,030 --> 00:01:40,790
make sure that you've input
the substring correctly.
29
00:01:40,790 --> 00:01:44,428
We notice that all of the datetime
strings have a space separating the date
30
00:01:44,428 --> 00:01:45,910
and the timestamp.
31
00:01:45,910 --> 00:01:50,650
So we can actually use FIND to
figure out where the date ends.
32
00:01:50,650 --> 00:01:54,900
Okay, seems like the space is
the 11th character in this string.
33
00:01:54,900 --> 00:01:58,080
So the timestamp substring
will start at character 12.
34
00:01:58,080 --> 00:02:02,610
We can use the LEFT and RIGHT functions to
select which parts of the string we want
35
00:02:02,610 --> 00:02:04,176
to isolate in a new column.
36
00:02:04,176 --> 00:02:07,743
We'll use RIGHT on one of these cells
to indicate that we want to grab
37
00:02:07,743 --> 00:02:08,502
the right side.
38
00:02:18,963 --> 00:02:23,620
And like we've come across before, LEFT
actually works exactly the same way.
39
00:02:23,620 --> 00:02:27,500
Now we can apply that to the rest of
column C to pull those timestamps.
40
00:02:29,170 --> 00:02:33,104
As a data analyst, being able to
work with strings is a key skill,
41
00:02:33,104 --> 00:02:37,680
especially when you find yourself
working with data from outside sources.
42
00:02:37,680 --> 00:02:42,108
Hopefully you're a little bit more
comfortable applying LEN, RIGHT, LEFT and
43
00:02:42,108 --> 00:02:45,010
FIND functions in both SQL and
spreadsheets.
44
00:02:45,010 --> 00:02:49,420
Later on, we'll use these functions to
perform even more complicated formulas,
45
00:02:49,420 --> 00:02:53,050
so feel free to try them
out on some data yourself,
46
00:02:53,050 --> 00:02:56,610
maybe even some open data
like we've been using today.
47
00:02:56,610 --> 00:02:57,220
See you later.4400
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.