# Randomly Select Cells Based A Couple Rules

Nov 6, 2007

I have a sheet that has 13 players listed in rows down column A. I have 6 columns each representing a quarter in a game. I was wondering what the best way would be to randomly select 5 players in each column and to distribute each cell selection as equally as possible over the 6 quarters.

So what I am doing is having excel designate equal amounts of playing time for each player each game.

Is this possible.

Can I base this off of previous games?

## Select A Couple Of Cells In A Row

Dec 1, 2009

I would like to write part of the code that select a couple of cells in a row (for example : Range("A1:A10).select) than:
-find a text which is in one of these cells (for example "HP") - and gives me back column in which this text is input

texts in selected cells will always be the same (for example : HP, CH, SD, .... ect.)

## Randomly Select One Of Two Cells To Populate From List?

Oct 16, 2013

I am wanting to randomly select one of two cells and then populate that cell from a list I have on a different sheet.

## Randomly Select From Alphabet Based On Letter Frequency Distribution

Jan 8, 2008

I want to randomly select letters from this distribution (to make random words) but I want the more frequent letters in the distribution to be selected more often so that the word I form have the same distribution. I have the feeling there is a simple solution to this but I couldn't see anything other than the frequency function that I thought I might be able to use. I could populate an array with letters present in numbers according to their frequency and then randomly select from it but is there a more elegant solution? .......

## Automatic Formatting Of Cells Based On Rules / Criteria

Jul 22, 2014

I have a long set of data that I extract a "table" out of based on index matching controlled by 4 different criteria. This part is working as intended. However I need to format the cells with the corresponding "fetched data" based on another criteria. Makes sense? Have a look at a spreadsheet i made representing my problem. It has comments for the problems.

excel tableformatting problem.xlsx‎

## Excel 2010 :: 3+ Conditional Formatting Rules For Cell Range Based On Formula From Other Cells

Feb 5, 2013

how to apply conditional formatting via VBA to a range of cells based on input from another range of cells. Obviously this would be easy in Excel 2010, but I'm still using 2003 at the office and it needs to stay in this format to be readable by other users:

For cells M8:EK8, my conditional formatting
condition 2: Formula Is =AND(\$E\$8>=M2,((\$E\$8-\$D\$8)>=(N2-\$M\$2))), color index is 40
condition 3: Formula Is =AND(\$F\$8<=M2,\$G\$8>=M2), color index is 39
I want to add:
condition 4: Formula Is =AND(\$H\$8<=M2,\$I\$8>=M2), color index is 40
condition 5: Formula Is =AND(\$J\$8<=M2,\$K\$8>=M2), color index is 39
and so on

The cells in the range M8:EK8 are blank, they only get colored based on input added to D8 to K8. If there is no input, then the cells should be uncolored.

resource tracking ex.jpg

## Select Fields At Randomly

Apr 11, 2008

I have a workbook with sheet 1 called Support which is basically an input form. The second sheet is called Database.

I want to enter data into the form and via a macro copy the data to the database. I have followed a text book to the letter on how this is to be completed to the letter.

My problem is that when the data is written to the database some of the fields are blank. Using F8 I can step through the VB script which appears to select fields at random.

## Select Names Randomly

Apr 17, 2009

I'm trying to pull 20 random names from a list of them every time I open the spreadsheet, and have them copied onto the clipboard to be pasted wherever. I have some code I found to accomplish this, but I'm not exactly what you would call VBA savvy. Could anyone look at this and see what I'm doing wrong? Or if it is right what I'm doing wrong to get it to work?

Sub GetRandom()
Dim iRows As Integer
Dim iCols As Integer
Dim iBegRow As Integer
Dim iBegCol As Integer
Dim J As Integer
Dim sCells As String

Set TempDO = New DataObject

## Randomly Select Items From DV Lists

May 14, 2012

I have a column of DV lists. Is it possible for me to make excel, go through each DV list, and randomly select an item from each DV list?

## Randomly Select Cell With Message Box?

Feb 15, 2013

The macro below will randomly pick a cell (with names)and fill with color. What I want to add is after it pick a cell a msgbox with a name of that person with YES/NO, if YES fill color. I need it not duplicate once it has already selected that cell(person).

Code:
Function RandCell(Rg As Range) As Range
Set RandCell = Rg.Cells(Int(Rnd * Rg.Cells.Count) + 1)
End Function

[Code]....

## Randomly Select From Table With Blank Cell

Oct 31, 2013

I am trying to randomly select 10 data from a table by using index formula. But there are some blank cell in the table so It kept returning 0 in the cell.

problem.xlsx

## Randomly Select Rows, Columns Or Ranges

Oct 18, 2006

by what means is it possible to unselect randomly selected areas, rows, columns from all sheets?

## Randomly Select Value Meeting Criteria From Table

Jan 17, 2007

I have a table detailing products and product options showing the options possible for each product. Each row has an option class and value(in separate columns):Color Red,Color Orange,Color Blue,Style A Style B and so on. Each product is in column.

Valid options for a product are indicated with a 1, invalid options with a 0. See attached sample file.

For instance, if the product in question is Alpha, then available colors are red and blue.

For a given product I need to return a randomly generated valid option. As I want to be able to drop in additional products and options, I want to return a value without resorting to manually generating a column containing only the valid options. The real data set amounts to dozens of options types and hundreds of parts for which I want to generate test data.

## Formatting Group Of Cells To Have Different Decimal Rules Based On Decimal Value

Aug 3, 2006

Basically, I want to format a group of cells to display 1 decimal figure if the number is not a whole number. If the number is a whole number (or if the rounded first decimal place is 0) I want it to display no decimal.

## Randomly Select Varied Amounts Of Data From A List

Sep 10, 2008

I have a list of people in column A and a list of Cities that they have visited in column B.

I need to check some of the cities they have visited monthly but don't want to check them all.

I have attached a sheet as an example (this has been scaled down).

The number of cities i want to check for each person varies each month depending on how many cities they have visited.

For example, John has visited 16 cities and i want to check 5 of them. I therefore want 5 random cities that he has visited to appear next to his name at the top. The real list of data is massive so this would be really useful if it is possible.

I have looked at rand but i can't get it to randomly give me more than one city, and i don't understand how to get it to give me say 5 cities one month and say 8 cities the next month purely based on a formula from another cell.

## Deleting The Rows Based On A Couple Of Variables

Nov 25, 2008

I have a worksheet ( adage inventory ) and I am trying to clean up some un-needed rows.

I need this deleting of rows based on a couple of variables.

I need to keep any row that Col F has the text "QCCONTROL"
and
I need to keep any row that COL N has the text "HOLD"
and
I need to keep any row that COL N has the text "REJECTED".

Sub Delete_OK_Lots()
lr = Sheets("adage inventory").Cells(Rows.Count, "A").End(xlUp).Row

For x = lr To 2 Step -1
If Sheets("adage inventory").Cells(x, "N") "HOLD" Or Sheets("adage inventory").Cells(x, "N") "REJECTED" Or Sheets("adage inventory").Cells(x, "F") "QCCONTROL" Then
End If
Next x
End Sub

## Determine Latest Price Based On Couple Of Criteria

Apr 17, 2014

I have actual date , then I have names of customer and I have product reference. And what I want to find out is the latest price COLUMN D for which this specific product was sold to specific customer (Data in rows E,F,G,H are from another tab). So basically I want is to find out that latest price of product x27 sold to customer A on 15.7.2013 was 70 because on 12.7.2013 we have sold it to customer A for 70.

A
B
C
D
E
F
G
H

[code]....

## How To Change Absolute Cell Reference Based On A Couple Of Conditions

Apr 28, 2014

I have a workbook that contains a column, G, which includes a formula that calculates distances (based on lat, long coordinates) to a training site ("TS" going forward) from other sites within the same district as that TS. There are numerous TS's in the company, usually 1 per district (but some districts do not have a training site), and I am trying to find a way to change my distance formula that will automatically detect which site is a TS, and then calculate the distances of those other sites in that same district to their respective TS's.

As it stands, I have to manually change an absolute cell reference every time I encounter one of these TS locations in the file (designated by a "TS" in Col F), and rerun the distance formula down the column. I would hate to have to do this several hundred times.

Attached is a sample file. Again, Col G contains the formula for distance calculation, and you will notice that the absolute cell references change each time a TS is encountered -- I have been doing this manually. Additionally, I would be curious to know if there is a way to spot any Districts that lack a TS, as in District 493, and specify that in Col G.

## Calculating A Discount Based On Certain Rules

Feb 11, 2009

I'm looking for assistance with working out the following formula. I live on an apartment complex in Marbella Spain and we pay Monthly Community Fees of say \$100.

We want to calculate a penalty amount for late payers of say 30% of the monthly fee due for non payers? So for instance if the monthly amount due in Cell D8 = 100 and the actual amount received in cell E8 shows 0 or then increase any figure due for the following month in Cell F8 should increase by 30% (\$ 130) in the following month. and so on

I use Excel ver 2003. Trust my query is reasonably clear?

## Delete Rows Based On Rules

Aug 21, 2007

I am trying to clear row with the following rules:

the last cell must not contain 0, if 0 delete entire row.
the first cell the the A row should be only three character long, if more delete entire row.

Now I managed to delete the 0 in the last cell and but cannot get the VBA to count the characters in the first row and if more than three, delete the entire row . I know to count the characters in a cell is done by Len(Rng.Value) , but getting the VBA right is alluding me .

the script is here,

Sub Del_rows_with_zero_in_column_of_activecell()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Const StartRow As Long = 1 'Row to Start looking at
Dim StopRow As Long
Dim Col As Long

## Excel - Date Validation Based On Rules

Nov 29, 2011

Validation on Excel

The User enters the date in cell D5 - I would like excel to validate the date based on the following rules:

1. Format "dd/mm/yyyy"
2. Prevents entering any weekend dates
3. When the user enters the date it can be the previous or current months date range

I have tried several ways in excel but I can't get anything to work. If an error occurs I want an alert message to appear.

## Some Cells Not Following Protection Rules

Aug 5, 2006

I have set all cells in a worksheet to be protected. I then selected specific cells that are not protected. The problem is that cells A11:D29 except C13:C14 do not follow the protection rules in that I can edit them (but when I right click, I cannot format, just like they're protected). These cells are NOT part of the group that was selected to be unprotected. When I unprotect the sheet and check the protection setting for these oddball cells, it shows as protected. All other protected cells do not allow entry (which is what I want).

## Automatic Fill Cells According Some Rules

May 15, 2013

I would like to fill some cells with a customer id if this customer is the same as the cell bellow. As my example below.

CUSTOMER idCUSTOMER NAME TYPE
737346 Nikos 81
1154765 Kyriakos 81

1154780 Thanos 81

I would like to fill automatically the empty cell bellow Kyriakos the customer id 1154765 in new column. I want in column "new" to fill with customer id and when the customer id is empty to fill the same customer id as above customer id.

Like the example below

CUSTOMER idCUSTOMER NAME TYPEnew
737346 Nikos 81 737346
1154765 Kyriakos 81 1154765
1154765
1154780 Thanos 81 1154780

## Use Validation Rules To Only Allow One Input In Multiple Cells?

Oct 5, 2009

Ive been having a little issue with this spread sheet. The problem ive got is I cant get the validation to work where it only allows one yes in a bunch of cells and gives an error message, heres an example of what im talking about.

## Script To Add Conditional Formatting Rules To Column Of Cells

Dec 2, 2013

I'm having to successfully add three conditional formatting rules, and associated cell interior colour formats if any of the rules are met.

Each time I run my macro, I want to refresh every cell, within a defined range within a Col P, with these rules.

So far, I can add the three rules to each cell, but when I try and add the format colour - for when a rule is met - I keep getting a 'Subscript out of range error'.

(As an aside, is my For / Next loop approach the best one to take to add the formatting to each cell, or can it be written much simpler?)

Here's my script:

VB:
Dim Col_P As Range
Dim Cell_in_ColP As Long
'Set up range of cells to add conditional formatting rules to
Set Col_P = Worksheets("tRIIO Pack Notices").Cells(2, 16).Resize(Lrow - 1)

[Code] ......

## Highlight Cell Based On Two Randomly Generated Number

Jan 19, 2014

I am trying to highlight a cell based on two randomly generated number, one is the column and the other is the row. Based on those values I want to change the color of a cell in a range of data. The formula I am using does not work like I intended. It only changes the cell once I enter a value in the cell not until. =OFFSET(A1,B27,B26). B26 and B27 are the cells housing the random numbers and A1 is the base reference.

## Randomly Select Four Names From List Of Names

Jan 22, 2014

I need to create a function that selects 4 names randomly from a list of 15 names and displays the 4 randomly selected names in the one cell. Also, you cannot repeat the same name in that cell, (i.e. bob cannot be selected twice in his group of four)

## Return Value Randomly From A Range Of Cells

May 16, 2013

I'll be collecting registrations on an Excel worksheet at a company event. Users will fill out a registration form, click a button, and the information is moved to a hidden sheet. That part works perfectly.

Periodically during the day, we'll give out door prizes, selecting winners from the list of registrants.

I need a macro that will look at the entries in column A in my hidden sheet and return one of them randomly.

I know there are random number generators, and I could make one of those work, but if I could just have it make a random selection from the populated cells in Col A, that would be slicker.

## Select Cells Based Value In Adjacent Column

Jan 4, 2008

How would you select cell values from differing rows based on the name in an adjacent column. ie, if it says John, add that data to the source data, if not move on.

## Automatically Select From Dropdown Based On Variables In 2 Other Cells

Jan 6, 2013

I have a sheet where I have a "Status" column in each row which could be "Waiting for Band", "Waiting for Organizer", or "Ready to Go!". These options are set as a data validation list. I have 2 cells later in each row where the response can only be "Yes" or "No". I want for the Status column to be set automatically based on the responses in the later two cells. So for example

where C3 and M3 are Yes, the status column in B3 should read "Ready to Go!"
where C3 is no but M3 is yes, the status column should read "Waiting for Organizer"
where C3 is no and M3 is no, the status column should read "Waiting for Band"

The above is actually an exhaustive list of all of the potential outcomes(!)