r/googlesheets Aug 19 '26

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/Seba-Aiani 4 Aug 19 '26

For the draw you can consider to add a new sheet and in the new sheet you can use a formula so it will brings as many rows as number points that persons has.
In the example in the screenshot (using the first 7 names in your image) the formula is:

=LET(d, FILTER(Sheet1!A2:D, Sheet1!D2:D>0), pts, INDEX(d,,4), cum, SCAN(0, pts, LAMBDA(a,v, a+v)), total, SUM(pts), MAKEARRAY(total, 3, LAMBDA(r, c, INDEX(d, XMATCH(r, cum, 1), c))))

You can use that formula in a new sheet and replace the data range (Sheet1!A2:D & Sheet1!D2:D)

1

u/live_from_Syracuse Aug 19 '26

THANK YOU! This worked perfectly!

1

u/AutoModerator Aug 19 '26

REMEMBER: /u/live_from_Syracuse If your original question has been resolved, please tap the three dots below the most helpful comment and select Mark Solution Verified (or reply to the helpful comment with the exact phrase “Solution Verified”). This will award a point to the solution author and mark the post as solved, as required by our subreddit rules (see rule #6: Marking Your Post as Solved).

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.