I am trying to tidy up some HTML and am using the w3c validator at https://validator.w3.org/nu/ but am getting a strange error:

Table column 3 established by element td has no cells beginning in it.

It points to the first row in the thead of the table. The relevant markup is shown below, can you see what the problem is? (clue, it's what caused the error): 


In my case, there were other tables that were the same(?) so why were some failing.

Look closely and you will see the colspan elements. colspan=5 in the first row of the head,  3 in the second row of the head, 2 in the first row of the body and 5 in the second. Effectively, the third column doesn't exist, it is inferred in 4 places but at no point does a row have an actual 3rd column so it is an error. In other words, we should have used colspan=4, 2, 0 and 4 so that the first row of the body would have defined the 4 concrete columns.

Easy when you know how!