Showing results for 
Search instead for 
Did you mean: 
New Member

how to display 2 random cells from an excel Table ?



I have a table with 2 columns. I need to display a random cell from the first column and a second cell from the other column.

I have no idea to do so.

I already do the random choice with a formula in excel so I only need to display it but I read that it's impossible. Maybe we can make the random choice inside powerApps.


Best regards,



Accepted Solutions
Super User
Super User

Hi @Nicroco7 

To refresh the random record, you would set a variable to random record by adding a button and setting the OnSelect property to the following:


You would then set your label text to


You can then click the button to refresh the random name.

View solution in original post

Resolver III
Resolver III

you can use the Rand() function. This is chooses a number between 0 and 1, so if you have 100 rows you can do something like:


This is would give a random whole number between 0-100.


Then you can use First() and Lastn() to get that row.


Something like this:

First(Lastn(your excel connector ,int(100*rand()))).column

New Member

Thank you for your answer but here is the error message. The translation is : there is an error in the formula, modify it and rerun it.


Do you think that I can write it in a text zone ? 

Yup! Just do another ".Value" on the end to get the text value. It might be something other than .Value, start typing "." And see what options show up.

Super User
Super User


An alternative to @DylanSimons's answer would be to call the Shuffle function. This function randomly reorders the records of a table.

The syntax would look like this:



@timl Your solution is great, I think I almost succeed but there is still a problem : it said "blank" while it isn't.

look at the pictures.

@DylanSimons Your solution doesn't work, it suggest nothing even with a ".". But the @timl method seems simple. Moreover, I haven't 100 cell in my columns. 


best regards,


@timl 's solution is much nicer than mine, glad it's working!


Are you putting that formula in the "default" property?

New Member

I don't really know, I only click on "text label", then I replace ' "text" ' by @timl 's istruction. 

I think I write the formula on both. (Look at the pictures please)

Super User
Super User


This is strange because your formula looks correct.

To diagnose this further, if you omit the Shuffle function, can you confirm whether you can retrieve the first prénom value with the following function?


One other thing to try would be Filter the result of Shuffle to return non blank values.

First(Filter(Shuffle(Tableau1); prénom <> "").prénom


Well done ! The formula is correct because with your test I've the same problem. It's really weird. My table is ok (it's not "tableau1" but "TableauNom" but it doesn't work anyway). I will learn one more time how to create an excel table 😅

Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,468)