// Grab the categories - top level only (depth=1)
$get_cats = wp_list_categories( 'echo=0&title_li=&depth=1' );
// Split into array items
$cat_array = explode('
‘,$get_cats);
// Amount of categories (count of items in array)
$results_total = count($cat_array);
// How many categories to show per list (round up total divided by 5)
$cats_per_list = ceil($results_total / 5);
// Counter number for tagging onto each list
$list_number = 1;
// Set the category result counter to zero
$result_number = 0;
?>