I have a spreadsheet in LibreOffice Calc 6.1.2.1. I have a column which had this formula:

```
=LOOKUP(D2,$J2:$Q2,$J$1:$Q$1)
```

It gave appropriate answers for about 2/3 of the cells, but gave #N/A for the remaining 3rd.

I replaced the column with this formula:

```
=INDEX($J$1:$Q$1,1,MATCH(D2,$J2:$Q2,0))
```

That gave me just what I wanted. However, I still don’t understand why these formulas are different. Shouldn’t they have the same results? Does this have something to do with sorting? Documentation for the lookup function here didn’t help me.