Index formula and Pivot Tables.

stereoqt

New Member
Joined
Jan 27, 2020
Messages
10
Office Version
  1. 2019
Platform
  1. Windows
Good morning, I'd like to ask a very basic question. I have a Pivot Table that consists of Names and Total Amount. Something like this:
A1 B1
Name1 1
Name2 1
Name3 1
Name4 1
Name5 1
Name6 1
Name7 1
Name8 1
Name9 2
Name10 2
etc.

I want to randomly choose 4 of those names. I found the following formula: =INDEX(data,RANDBETWEEN(1,ROWS(data)),1) It works perfectly when I change "data" to the range of the Pivot Table, for example A1:B10, the problem is that I have to change the formula everytime I update the table. I want to do it dynamically. The Pivot Table name is "FilteredNames", when I try to replace it instead of "data", I get an error. Is there any way to reference a pivot table or in any case, an easier way to achieve what I want to do?
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

stereoqt

New Member
Joined
Jan 27, 2020
Messages
10
Office Version
  1. 2019
Platform
  1. Windows
I had completely forgotten about the Offset formula, problem solved.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,315
Messages
5,641,482
Members
417,211
Latest member
loadius

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top