You will pull the free Titanic dataset from Kaggle into Google Sheets, clean the columns, and use pivot tables to find the splits that matter. Then you turn those splits into a simple decision tree you can check against real survival results. It suits beginners who want hands-on data practice.
YouTube video: How to Build a Machine Learning Decision Tree in Google Sheets
YouTube’s video details do not confirm captions. Check CC in the player for available tracks.
- Video length
- 3 min
- Time to do it
- 30 minutes
- Difficulty
- Medium
- Steps
- 9
What you need
Steps
Sign up for a free Kaggle account, open the Titanic competition, and download train.csv from the Data tab. It holds 891 rows of passenger details with survival labels.
Upload train.csv to Google Drive, then open it with Google Sheets. Keep the header row and duplicate the tab so your raw data stays untouched.
Delete columns you cannot learn from, such as PassengerId, Name and Ticket. Keep Survived, Pclass, Sex, Age, SibSp, Parch, Fare and Embarked.
Fill empty Age cells with the median age, then remove the rows where Embarked is blank. Gaps break pivot table averages and skew your splits.
Add an age band column with a formula like =ROUNDDOWN(D2/10,0)*10 so ages fall into decades. Pivot tables handle a few clean buckets better than 80 exact ages.
Select your cleaned range and choose Insert, then Pivot table. Put Sex in Rows, Pclass in Columns and Survived in Values, set to AVERAGE, to see survival rates.
Read the table and pick the split with the biggest gap in survival rate. That becomes the first node, or root, of your tree.
Repeat the pivot table for age band and fare, then write each rule as a nested IF formula in a new column. Every branch ends in survive or die.
Score the tree by comparing your predicted column with the real Survived column using COUNTIF. Divide the matches by the total rows to get your accuracy.
Tips and common mistakes
Set the Survived value field to AVERAGE rather than COUNT, or the pivot table shows passenger totals instead of survival rates.
Right click a pivot table and choose Refresh after you edit the source cells, because it does not update on its own.
Leave Name, Ticket and PassengerId out of your inputs. They look useful on small samples but do not generalise.
Keep the tree to two or three splits. A short readable tree is easier to explain and to check than a deep one.
Questions
Do I need to install any software?
No. A free Kaggle account, a Google account and a browser are enough. Google Sheets opens the CSV file directly from Drive.
Can Google Sheets train the decision tree for me?
Not natively. You build the tree by hand from pivot table splits and IF formulas, which is what teaches you how the model decides. A Sheets add-on can fit models, but do the splits manually first.
How accurate will my hand-built tree be?
Expect modest results. Two or three splits rarely beat a full model, and that is fine. The goal is to understand how a split is chosen and tested.
The notes are drafted automatically from video details and general task knowledge. How the guide was prepared
Report a correction


