How to repeat a rows a number of times based in cell value

Hi I need something like this
Original spreadsheet
name group quantity
John A 3
Mary B 2
Peter C 2
Bob A 4
total 11

Processed spreadsheet
name group quantity of
John A 1 3
John A 2 3
John A 3 3
Mary B 1 2
Mary B 2 2
Peter C 1 2
Peter C 2 2
Bob A 1 4
Bob A 2 4
Bob A 3 4
Bob A 4 4
Total 11

Any Ideas?

Regards
Antonio

Hi Antonio, if you can explain better what you achieve and how are your data disposed.
To get data in different lines add a couple of spaces at the end of line plus enter.

I think Menu/Data/Subtotal or Menu/Data/Pivot table could help.

Antonio – I know fairly little about writing macros for LO, but I felt challenged and wrote out the “logic” for a program that I believe would (if converted into executable code) produce exactly what you want. It is written on a Calc SS. If it’s of any use to you, let me know, and suggest a way to get it to you (can attachments be posted here?; or an email address) and I’ll send it.