Populate random quality assurance checks into a Criteria column based on a set percentage

SkywardPalm

Board Regular
Joined
Oct 23, 2021
Messages
61
Office Version
  1. 365
Platform
  1. Windows
I am attempting to populate random quality assurance checks into a Criteria column, if there are less cells populated with a Criteria (High Cost, High QTY) than the required (say 10%) quality check, then a "RANDOM" will be the cell's value. I can't wrap my mind around how to accomplish a legitimate random process that will populate based on the proper percentage (actively, on worksheet change). The percentage is set upon file creation in Range("Percent"). (It would also be nice if it didn't choose the first cell for a random on every instance if criteria is missing from first entry)
Column "AG" is where the criteria should populate. I multiply by 100 because the percentage is stored as a decimal.

VBA Code:
        'add a RANDOM after calculating if cells with criteria/value are < percent of quality checks
        If IsEmpty(Range("AG" & ActiveCell.Row)) And Application.WorksheetFunction.CountA(Range("AG2:AG" & ActiveCell.Row)) < (Range("Percent") * ActiveCell.Row * 100) Then Range("AG" & ActiveCell.Row).Value = "RANDOM"
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,216,212
Messages
6,129,540
Members
449,515
Latest member
lukaderanged

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