# A field containing the number of items in a variable

In LibreOffice Writer, if I want to insert a page number I do:

Insert > Field > Page Number


Similarly, if I want to insert the number of pages I do:

Insert > Field > Page Count


I can also use LibreOffice to keep track of numbering of things like tables, for example, or, in my example a custom field like question number. To use this I do (there are other ways of doing this):

Insert > Field > More Fields... > Variables > Number Range > Question


(latter assuming I have created a custom field called Question, which I can do from the same place)

However, what I want to do is insert a field that provides the number of items in such a range. For example, if I have 3 questions, and I want to insert the question count, it should insert a field that is currently reading 3, but would update to 4 if I insert another question.

My use case is this: I am using automatic numbering to number questions in exams. However, manually inserting the number of questions is prone to human error (and is a very useful thing to do to ensure students do not miss questions). I am imagining there are many similar use cases so am imagining this kind of thing may be possible.

edit retag close merge delete