Thinking that original data is in Sheet1.A1:B22 (or A:B complete columns), and summary from Sheet2.A1:B1 down.
Paste in Sheet2.A1:
Paste in Sheet2.B1:
Fill down as needed.
See sample file.
More LibreOffice Help on ROW, SMALL, VLOOKUP, IFERROR.
Tested with LibreOffice 22.214.171.124 (x86); OS: Windows 6.1.
Add Answer is reserved for solutions. If you think the answer is not satisfactory, add a comment below, or click edit (below your question) to add more information.
Check the mark ( → ) to the left of the answer that solves your question.
If the answer helped you, you can mark the up arrow () that is on the left (to vote, you need to have karma of at least 5).