Next: Checkboxes, Previous: Priorities, Up: TODO Items

### 5.5 Breaking tasks down into subtasks

It is often advisable to break down large tasks into smaller, manageable subtasks. You can do this by creating an outline tree below a TODO item, with detailed subtasks on the tree1. To keep the overview over the fraction of subtasks that are already completed, insert either ‘`[/]`’ or ‘`[%]`’ anywhere in the headline. These cookies will be updated each time the TODO status of a child changes, or when pressing `C-c C-c` on the cookie. For example:

         * Organize Party [33%]
         ** TODO Call people [1/2]
         *** TODO Peter
         *** DONE Sarah
         ** TODO Buy food
         ** DONE Talk to neighbor

If a heading has both checkboxes and TODO children below it, the meaning of the statistics cookie become ambiguous. Set the property `COOKIE_DATA` to either ‘`checkbox`’ or ‘`todo`’ to resolve this issue.

If you would like to have the statistics cookie count any TODO entries in the subtree (not just direct children), configure the variable `org-hierarchical-todo-statistics`. To do this for a single subtree, include the word ‘`recursive`’ into the value of the `COOKIE_DATA` property.

         * Parent capturing statistics [2/20]
           :PROPERTIES:
           :COOKIE_DATA: todo recursive
           :END:

If you would like a TODO entry to automatically change to DONE when all children are done, you can use the following setup:

         (defun org-summary-todo (n-done n-not-done)
           "Switch entry to DONE when all subentries are done, to TODO otherwise."
           (let (org-log-done org-log-states)   ; turn off logging
             (org-todo (if (= n-not-done 0) "DONE" "TODO"))))

         (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)

Another possibility is the use of checkboxes to identify (a hierarchy of) a large number of subtasks (see Checkboxes).

#### Footnotes

[1] To keep subtasks out of the global TODO list, see the `org-agenda-todo-list-sublevels`.