Your ultimate purpose seems to be able to give the name of the winner. The row number has no relevancy, it is only an intermediate result.

Work differently.

I assume that your tickets are sold in batches, say 10 tickets per batch.

Build your spreadsheet with the starting ticket number of every batch in column 1 (no need to have the ending ticket number even your batches have unequal length because this number is one less that the next starting number). You can enter the ending number in column 2 but this is not necessary.

Enter the purchaser name in column 2 or 3.

Enter a number larger than any others in the last row (stop guard).

The trick here is to sort the column-1 numbers in ascending order. For example purpose, I assume this table is in `C1:C100`

(3-column table allowing for 1000 tickets in batches of 10).

To display the winner's name in a cell, enter the winning ticket in `A1`

and read the name in `A2`

with the formula `=VLOOKUP(A1;C1:C100;3)`

where the `3`

is the column number of the name in the ticket table.

*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.