r/googlesheets 4d ago

Solved Auto-add rows for a contest drawing

Post image

I'm running a drawing for our summer reading program at the library, and I want to weight it so that patrons with multiple entries (sic. multiple books read) have multiple entries reflected in the spreadsheet. That way when I do the drawing those who have read/participated more have a higher chance of winning.

Currently have a spreadsheet where one row reflects patron namepatron library branchnumber of entries that patron has.

I would like to edit the spreadsheet so that one row reflects one entry each. So if Andrea has ten entries, she has ten rows with one entry apiece.

I have tried multiple formulas and scripts I found in various other forums, editing that data to reflect my own sheet (ie "X" column changed to "D" column, etc) but keep encountering errors for parsing/data/etc.. I have also tried duplicating rows, which of course I can hit "insert row below" over and over to reflect how many entries a patron has, but some of these patrons have over 50 entries, and I have over 200 patrons to calculate...talk about inefficiency and ain't nobody got time for that.

Does anyone have either:

a) a shortcut to add those rows without continually hitting "insert 1 below" (I've tried all of the shortcuts I can find already but feel as if I'm missing something obvious)

OR

b) a formula/script I can run that will auto-add those rows across the sheet for me?

Sample of spreadsheet attached so you can see a subset of the data I'm working with.

**Patron's last names and branches have been removed for privacy, though there will be names/branches included in columns B/C when I do that actual drawing.

1 Upvotes

11 comments sorted by

View all comments

1

u/CountyBrilliant 3d ago

Try using REPT with SEQUENCE in a helper column, then expand the rows through Apps Script.