## Explanation

In this example, the goal is to group ages into buckets. One way to do this is to prepare a table with age breakpoints in the first column, and the name of the appropriate group or bucket in the second column. Then use a lookup function to find the right bucket or group for each age. In the example shown, we are using the VLOOKUP function for this job, and the formula in cell F7, copied down, is:

```
=VLOOKUP(D5,age_table,2,TRUE)
```

The inputs to VLOOKUP are as follows:

*lookup_value*- the age from cell D5*lookup_table*- "age_table", which is the named range G5:H8.*col_index_num*- 2 to indicate "2nd column"*range_lookup*- TRUE to specify an approximate match.

Note that because the last argument, *range_lookup*, is optional and defaults to TRUE, it is not necessary to provide a value for this problem. However, I personally like to set this value explicitly as a reminder of the match behavior that is expected. Also note that we are using a named range for convenience only, since named ranges do not change when copied. If you prefer, you can use an absolute reference like $G$5:$H$8 instead. We don't want this reference to change as the formula is copied down.

In the configuration above, VLOOKUP looks up each age in the table and returns the appropriate group from the second column. Because VLOOKUP is set to perform an approximate match, it has a particular behavior. It will scan through the ages and stop at the first exact match, or, when no exact match is found, it will stop at the first larger value and then "step back" to the previous row and return the group from that row. The groups in the second column can be any values you wish.

For more details on VLOOKUP, see How to use the VLOOKUP function.

### Pivot tables

Pivot tables can automatically group numbers, but the VLOOKUP approach allows you to perform completely custom grouping.