Question: I am getting a syntax error on this statement below that combines an If, IsError and VLOOKUP statement - I been trying everything..... anyone know why?

```
If Application.Worksheetfunction.IsError(VLOOKUP(cell.Value,'[Codes.xlsx]Processing Codes'!ProcessingCodesTable,5,FALSE)) = FALSE then

```

Thanks any help would be greatly appreciated!

Answer: 
A SQL table represents an *unordered* set. There is no concept of "in-between" (or first or last or previous or next). The rows simply are; they are in the table.

Queries return *result sets* that have an order. And, you can control the order when you write the query. That is why you use the `order by` clause. When you write:

```
select *
from mytable;

```

The results are in any order that the database wants to return them. There are simply no guarantees. Instead, query the database as:

```
select *
from mytable
order by col1;

```

And you will get the data properly ordered.

The moral of the story: just insert the data into the table. When you query it, use an `order by` clause to get the results in your desired order.
As others have noted relational databases are not really meant to work with ordered lists.
You could work out some convoluted solution like select the "math" rows followed by "science" rows and then use that to insert "Physics" row.

Something like:

```
CREATE TABLE temp_table AS
(
(SELECT 
t1.id+1 AS id,
'Physics' AS course
FROM 
table t1 JOIN table t2 
ON 
t1.course='Maths' AND t2.course='Science' AND t1.id+1=t2.id)
UNION
SELECT * FROM TABLE)

```

And then work something to update other labels maybe using rank() windowed function.