I have a weird LibreOffice Calc problem. I have a table of chapters from the five published books in the A Song of Ice and fire series. Here is a facsimile:
A B
1 | Book | Chapter
----+----------------------+-------
2 | A Game of Thrones | 0
3 | A Game of Thrones | 1
...
75 | A Game of Thrones | 73
76 | A Clash of Kings | 0
77 | A Clash of Kings | 1
...
147 | A Storm of Swords | 0
...
230 | A Feast for Crows | 0
...
276 | A Feast for Crows | 46
277 | A Dance with Dragons | 0
...
350 | A Dance with Dragons | 73
I'm using a MATCH
and OFFSET
formula to find the last chapter in every book, by first MATCH
ing the last row for a value in the Book column, then getting the value from the Chapter column. So, to find the last chapter in A Game of Thrones:
=OFFSET("A Game of Thrones", MATCH(A4, A2:A350, 1), 0)
Then this would output 73.
This works for the first three books. A Feast for Crows and A Dance with Dragons don't work. When I run the MATCH
formula:
=MATCH("A Feast for Crows", A2:A350, 1)
It should return 276, which is the number of the last row with the value "A Feast for Crows", but it returns #N/A
. However, when I use the range A75:A350
, it returns 72
. If I use A76:A350
, it returns 71
, and so on, with the output decreasing as the lower limit increases. Until I change the range to A110:A350
, where the value becomes 167
(again decreasing, inversely proportional to the lower limit of the range.) The search criterion is correct, there are no leading or trailing spaces or miscapitalised words. I'm using LibreOffice Calc 4.3.1.2.
The results of the MATCH
are baffling me; I don't know why it's not outputting correctly. Can you suggest what's gone wrong here?