usage of the result of a count so that it can be used inside of a formula in writer

hi, it possible to use the result of a count so that this value can be used in a formula?

example: if i search all paragraphs starting with A:\t_endA_ i obtain a certain value, is it possibile to use this value to place it maybe inside of a cell of a table so that it gets automatically updated (and can be used in formulas to give results)?

@Lupp thanks for answering, yes it’s a math formula but everithing is writer; i’m trying to calculate how many questions are not answered in a document that contains thousands of questions;

all Questions have an unique style for questions and are list numbered

all Anwers have their own style for the answers and all begin with a common begin_keyworkd_for_the Ansers end end with an end_keyworkd_for_the Anwsers (_startA_A:\t at the beginning of each Answer paragraph , endA at the end of each Anwer paragraph)

for the Questions i could place this updated result creating a cross reference value of the last listed numbered question (precious tip of @ajlittoz) so that i could use this value in a cell of a table (that has beeen used in a matematic formula to give a result)
since i’ve been amazed by the power of writer and it’s extensions i was trying to see if there was a way to do somthing similar even for the Answers

@ajlittoz thanks for answering; doneplease telle me if i have to detail better; I feel you’re looking to get the number of paragraphs with a given property; exactly; linux; libreoff 6.1.5.2

my skill level: well i suppose low :slight_smile:

(Every time we say “no way”, we must intimate we just might not know the way.)

There is no AutoCalculate in Writer. You would need to trigger any recalculation (counting e.g.) by an event.
Concerning the term “formula” I woud want explanation. Are you talking of a TextTable formula? Do you want to update a Math formula? Is it about an embedded spreadsheet?

Anyway: To get something of the kind you need to write code.

You need to give more detail on your goal by editing your question. Provide an example of the final effect. I feel you’re looking to get the number of paragraphs with a given property. This might be solved with a cross-reference but you must better describe the use case. This will work if you format your document with styles and, I insist upon that, without direct formatting, i.e. without using toolbar buttons, Ctrl+B and the like, … Tell us about your skill level in Writer and mention your OS name and LO version.

Please do not use Add Answer but edit your original question to enhance the details of your question (answers are reserved for solutions to a problem on this Q&A site).

Firstly there is a misunderstanding. "Math formula" was meant to mean something typeset using the LibO component Math. That’s nothing used to calculate (“do math”) with.
You obviously want to calculate somerthing.
Then, secondly, Writer is the wrong tool for it. The software pretends to be able to do calculations in TextTable_s, but there’s just a handful of operators and functions, and the usage is extremely unhandy.

I’m afraid this can’t be done the way you expect. I would try a hacky workaround.

Your question are already list numbered. Therefore you can reference manually the last question and display the number. Note that a cross-reference is not an arithmetic value, i.e. you can’t do algebraic computations with it; you just display it.

Then you have “Questions: 999” using the last number.

List-number the first paragraph of an answer. Use a different list style for the answers so that questions and answers are numbered independently form each other. The list style must be attached to the paragraph style for the first paragraph in an answer. Otherwise, multi-paragraph answers will have several numbers and you won’t be able to compare the counters usefully. Customise the list style so that it uses a character style on the numbering with Font Effects Hidden (the answers will be numbered but the number is not displayed).

I strongly suggest you enable display of hidden text so that you can diagnose what’s happening. Hidden text receive a dotted underline to warn you about it.

Use a manual cross-reference to the last answer to capture the last number.

You get “Answers: 999”. You can now compare visually (not algebraically) the magnitudes.

CAUTION! The procedure is manual. This means you must move the cross-reference to the last occurrence yourself. It is not automatic.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.