Excel formula will identify the sample in sheet

rplim2016

Board Regular
Joined
Jun 28, 2016
Messages
76
Hi Mr. Excel Users,

Imagine that we have 1:1 is header 2:300 is rows (source data) 299 rows...

from 2:300, in column A i need to create a formula that will tell me the 13% sample size of that 2:300 in column B.

299 * 0.13 = 38.87 rows in column A should have marked "Sample/Audit" if we would round it down to align properly, we can have 38 rows.


The logic is from the source data, the excel formula in column A will automatically identify the "Sample/Audit" in the selection.

13%
 
Last edited:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Let Sheet1!B1:B300 house the data with a header in B1.

In C2 enter and copy down:

=IF(B2="","",RAND())

Select the C range. Copy it and run immediately Paste Values. This step stops generating new random numbers.

In D2 enter and copy down:

=IF(B2="","",RANK(C2,$C$2:$C$300))

Sheet2 is used to gather a random sample of 13% from the data in column B of Sheet1.

In A1 of Sheet2 enter:

13%

In A2 of Sheet2 enter:

=SUMPRODUCT((1-(Sheet1!$B$2:$B$300="")))

In A3 of Sheet2 enter:

=ROUNDDOWN(A1*A2,0)

Leave A4 of Sheet2 empty.

In A5 of Sheet2 enter:

=AND(Sheet1!$D2>=1,Sheet1!$D2<=$A$3)

Note. A4:A5 constitutes the criteria range we use to create the random sample.

The recipe that follows shows how to use Advanced Filter.

Select A4:A5 of Sheet2 and fire up Advanced Filter (Data | Advanced).

Set the Action check to 'Copy to another location'.

Set List range to Sheet1!$B$1:$D$300.

Set Criteria range to Sheet2!$A$5:$A$6.

Set Copy to Sheet2!$A$6.

Click OK.
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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
Back
Top