# Penalty Based On Criteria In Another Cell?

Sep 28, 2013

In my country, students are penalized when they fail Mathematics subject. That is when a student gets "F" in Maths. The penalty is only for those scoring Division I and II. The divisions change into Division III for those penalized but points remain the same. For example if a student ie Juma gets Division I of points 17 and he fails Maths, he should be penalized and get Division III of points 17. NB: Those who score Division III,IV and 0 are not penalized even though they fail maths.

## Copy Cell Value To Cell On Other Sheet Based On Two Criteria

May 8, 2014

I used this vba code before:

[Code] ......

And it worked perfectly, but now i wanted to use it in an other file but just change the sheets and I keep getting an Error 13.

It should copy the data from sheet insertmeasurements c23 till end of data in the column next to it (is dynamic) and based on cell B1 and the matching category code in column B, put that data in the matching cell in column C to the matching cell (based on the criteria in column B and C) on the sheet storedata.

Attached File : Profitibility Database v1.4.xlsmâ€Ž

## Copy Cell To New Location Based On Criteria In Another Cell?

Jun 25, 2014

I've sent out a survey asking people to sign up for one of two groups, A or B. I have a table with a long string of responses, with the name in column A, and in columns B or C there is an X that shows whether they have chosen Group A (column B) or Group B (column C)

I am trying to write a bit of code where it would paste the names into a new table with the headers Group A and Group B. Here is what I have pieced together so far:

Sub Create_Groups()
For i = 2 To Range("B2").End(xlDown).Column()
If Range("B" & i).Value = x Then

[Code].....

## SUM Based On A Criteria And Another Cell Being Blank

Apr 23, 2009

I need to create a formula that counts up the number of times a specific word is put into a cell lets say 'Carpet' only when another cell is left blank.

Count the number of times between C1:10 the word 'Carpet' is input only when D1:10 is left BLANK?

If looked into DCOUNTA formulas and SUMPRODUCT formulas but seem to be clutching at straws.

My problem seems to be at referring the formula to the BLANK cell?

## If Statement Based On Various Cell Criteria

Aug 11, 2009

G5 - can contain True or false
G6 - contains text but the if is on the basis of this cell being "Hand Delivered" or not

I have tried the following to illustrate what I after:

## Populate Cell Based On Two Criteria?

Aug 2, 2013

I have a list of teams, and beside them I need a calculation to be filled.

The criteria is based on a cell reference (a month which can be changed from a drop-down in BM2) and also the name of the team.

dummy 16.xls

## Clear Cell Based On Criteria

Apr 18, 2005

I'm trying to write a macro that clears the cell in the range V10:X14 if the value of that cell equals 99.

Sub MyDeleteCell()
For i = 10 To 14 Step 1
For j = 22 To 25 Step 1
If Cells(i, j) = 99 Then Cells(i, j).Clear
Next i
Next j
End Sub

It's giving me a "Invalid Next Control Variable reference" I've tried defining i and j as Integers but that didn't work.

## Add Cell Note Based On Criteria

May 28, 2013

I have a range of cells containing text values in BS15:DS50000.

What I want to do is look at each cell in the range BS15:DS50000 and if the cell contains the "" character, then populate text from column BH (if any) as a cell note.

For example, if cell DB42 contains the "" character somewhere within its text, then populate the text in BH42 as a cell note within DB42.

If BH42 is blank, then no cell note. (Also, if DB42 does NOT contain a "", then no cell note either.)

## Change Cell Value Based On Criteria

Dec 7, 2006

I have a series of data that I am trying to process based on various criteria and though this site I have solved most of the (simple) problems I had. I have one last problem to solve.

I need to add the previous cell to the next one based on a cell value in a different column.

Example: I want to add F2 to F3 if H3=3 but I need it to work so that if H4=3 it will add F3 to F4 and F3 now equal the new value i.e. (F2+F3). If H5 doesn't = 3 then F5=F5. I need the output to be a value not just an equation as I plan on going back and deleting all rows with H=3 in them.

P.S. I don't mind if the output of the calculation of the F column is to a new column or overwrites F. Overwriting would be easier for when I go back through and delete rows based on H=3.

## Parse A Cell Based On Criteria

Jan 19, 2007

I want to parse a cell if a date is present for example I have 03/26/1985 AL in one cell and want to parse to two different cells however in between those cells I have other cells with different data that I dont want to parse. Basically I need to parse the cells only if a date is present.

## Select Row Based On Cell Criteria

Feb 15, 2007

I am trying to create a macro that selects an entire row based on a date criteria. The explanation is as follows: I have fields in an excel sheet such as: Name, Date, Place, Time, Country etc….. There are many rows with data in them…. I require a prompt box that asks for a date range and then selects all the contents matching that criteria and copies into another excel sheet called Export.xls.

## Assign Yes / No To Cell Based On Meeting Some Criteria?

Jun 24, 2014

I need to write an excel function/macro/code to assign yes or no to a cell if the Description fits a certain category. I have attached a sample workbook and will explain what I mean.

In the sample workbook, there is data on a company. This included a unique ID, city, state, and description. What I want to do is fill out the yes/no column. So if a particular company has 2 of the 4 necessary "Descriptions", then column G will return yes, otherwise No. It must return yes for a particular company/ID if 2 of the "Descriptions" are "Sale", "Service", "Business", or "Par". I only want it to count at least two unique descriptions.

For example, in the sample workbook, Company A has all 4 of the necessary descriptions, thus everything in column G for this specific client should be yes. For Company B, only 1 of the 4 descriptions matches, so it returns No for all Company 2 columns. Company C has 2 of 4, so it returns yes for these columns. Note, it doesn't matter for Company C that "Business" was listed twice. It only needs to count the first unique time that description occurs.

## Pivot Table Criteria Based On Cell Value?

Jan 27, 2014

filter my pivot table using a cell value, rather than manually selecting from the dropdown.

The report filter title is Rnd H, and values start from 0 through to 2, at .1 intervals (so 0.1, 0.2, 0.3, 0.4 etc).

Rather than select "0.3" manually from the dropdown, can the pivot table do this if "0.3" was written in cell A1 for instance?

## Combine Cell Entries Based On Criteria

Mar 12, 2014

I need to first merge cell entries of column 2 if cell entries of column 1 are the same; following columns always retain their corresponding first row (see cells highlighted in yellow in attachment).

## Insert Row Macro Based On Cell Criteria

Jan 29, 2009

I'm trying to create a macro that takes data from one row and inserts it into a new row. Attached is a workbook with a before and after example of what I'm trying to do.

Each row has a security transaction that includes principal cash and interest. The data needs to be formatted so that each transaction has one row for principal and one row for interest.

Principal is identified by the tran code PAYDOWN in column C. Interest is identified by the tran code INT. However, the raw data generated includes both interest and principal under the tran code PAYDOWN.

There could be 100 or 1000 transactions generated based on the day.

## Macro To Move Cell Down A Row Based On Criteria

Feb 20, 2009

I would like a simple macro that would actually move a cell based on criteria. In my case it would be: In row A, if a cell starts with 'Agent Name' then that cell needs to move down one cell replacing the contents of that cell.

## Copying Data From One Cell To Another Based On Criteria

Jun 22, 2014

I am trying to use VBA to move data from one column to another while using values of a third column as a reference for where each value in the first column should be moved to in the second. I will try to explain as best as possible, currently I have a macro that copies from one column to the required but due to the irregular spacing of the data it results in the data not matching with the data its being copied into.

Say I have Three columns A, B and C. I have a range of data in column A say dates that have irregular amounts of spacing between them. Column B is empty. Column C contains Data that is again spaced out irregularly and not in line with that of A. The value of column C cells is just identical values. Now the aim is to move the values from column A in the order which they are listed and place them in Column B next to each value in Column C. So say the repeated value in column c is EXAMPLE then everytime EXAMPLE appears in column C i want to move one date from column A into column B next to this EXAMPLE value, in order which it appears in column A. So the first date will move next to the first EXAMPLE value and the second date which appears next to the second EXAMPLE and so on and so on until it reaches the end of the sheet.

My thinking was placing the A column data in an array and doing some sort of sort.

## Copy Cells Based On Criteria In Other Cell

Mar 20, 2009

I want to copy cells A&B where there is a value in G to a new workbook. I need to loop through the workbook as there are 25 sheets in the workbook, and there 8 workbooks to go through.

There are 31 rows on each sheet, and there are only a few values in column G on each sheet.

A is customer name, B is Account No, G is Insurance premium paid, columns C to F, and H to M have other accounting data in them.

The idea is to create a global list of all customers who have already paid their insurance premiums.

## Formula- Sum Values In Col H Based On The Criteria Set In CELL B1

Oct 3, 2009

i need a formula that will sum values in Col H based on the criteria set in CELL B1. The tricky part is that i need the summed values to be converted using the FX rates in Cell M:N, i have provided an answer on what the formula should return in CELL C2....

## Selecting Rows Based On Cell Criteria

Mar 19, 2005

I'm sure there is simple code for this but I have excel spreadsheets like the sample attached that are consistant in the types of fields but the only data I want to strip out are the rows where column A has a "G" in the cell, I tried using this

Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select

but this doesn't work when there is only one row of data. The number of rows with valid data will vary each day. I then tried an if, then statement and a loop but I could never get the loop to stop. I basically want a macro which parses through the worksheet and selects the rows that have that "G" in column A so I can copy them and paste them in another worksheet.

## Adding Worksheets Based On Cell Criteria

Aug 4, 2006

I would like one column (column A) to be an "indentifier" column. Column B is the customer name, column C is the customer city and state, column D is the customer phone number, and column E is the customer email.

By calling column A an "identifier" column, what I mean is that I would like to be able to go down the list and put an "x" next to each customer I would like to include in that particular workbook. I would then like to be able to run a macro which would take each of the customers with an "x" in the column A, create a copy of the template comfirmation call sheet, and fill in the identifying information from columns B through E into the copied template. Each worksheet would also need to be renamed the same as the customer name. It would need to perform this same procedure for each row that has an "x," making sure that all worksheets (confirmation call sheets) are grouped into one new workbook.

Sheet 1 is called "main"
Sheet 1 contains 5 columns
A = Blank
B = Customer Name
C = Customer City and State
D = Customer Phone
E = Customer email

Sheet 2 is called "template"

"x"'s are placed into "main" sheet, column A to identify which customer will be affected by macro...................

## Calculate Formula Based On Cell Criteria

Aug 30, 2006

I only want the formula to operate when there are values to calculate and then ONLY refer back to the last calculation. If there are gaps between the calculations I would like those to remain blank. Is that possible?
I have attached an example of what I am trying to do.

## Populate Cell Based On Multiple Criteria

Dec 7, 2006

I think the best thing is to take a look at the attached, then read what I'm looking for, as it would make more sense...

That being said: what I am looking to do is change cell L3 based on new criteria in cell M3.

Right now if B3=Stationery World then L3=Stationery.

What I then want to happen is if E3=Toner then M3=67200 which then has L3=Equipment Consumables and NOT stationery.

## Make Cell Mandatory Based On Criteria

Dec 28, 2006

I trying to require data entry in Cell 2 if Cell 1 contains text. Normally Cell 1 is blank but once the user enters data (its a text field) I want Cell 2 to then become mandatory for data entry. (Cell 1 is actually C5 and Cell 2 is actually DK5. So formula I am thinking if is: If C5 contains data then DK5 must also contain data. If C5 is blank, the DK5 is also blank.

## SUM X Column Range Based On Criteria In Cell

Mar 19, 2008

Im trying to do a sumif reading the name in column N (either "Business" or "Procurement"), and suming all values in the range AW:AY.

this is what I have come up with....

but it returns incorrect values and not the whole range????

Any ideas? Auto Merged Post Until 24 Hrs Passes;here is an example of what im trying to do...

H2 and H3 are my attempted formulas

## Insert Range Of Cells Based On Cell Criteria?

Apr 1, 2014

I will have a list of unique values. For each unique value, there is an indicator that tells me how many lines of information I need. Based on that criteria, I need a macro to insert that many rows and populate it with text. This will ultimately become a look up table that I will just use index/match function to populate.

I've attached a sample sheet. I'm not sure if I need a macro to insert rows or a macro to paste a copied range. Or maybe I need a mixture of both with a formula to calculate the number of cells I need?

## Two Page Lookup Matching Criteria Based On Cell Value

May 26, 2009

I have an items list on page 2. On page 1 I want to create a drop down menu in C2 that references the list on page 2. Then when I choose an item, I want the additional information in cells D2 and E2 to come in automatically. The list on page 2 will be expanding daily, and when I expand it I can simply insert a new row so I correctly alphabatize it instead of constantly having to resort it.

With that said....
1. How do you put in the drop down box that references information on a different sheet?

2. What is the best way to reference the information in my ever expanding situation: Index/Match, Vlookup, Lookup, or something I havent mentioned?

## Conditional Formatting - Highlight Row Based On Cell Criteria

May 19, 2013

I need a macro that will highlight a row based on a cell criteria. I have used conditional formatting but there is a lot to format and has dramatically slowed the sheet down. However, I know nothing about macros/vbas.

E.g. If it states JI sent then I want the whole row to be highlighted light green.

App form needed = peach
Waiting list = light blue
Cancelled = red font strikethrough
DNA = purple font strikethrough.

Also - it could well be that in the row it has App form received, JI Sent and DNA all in 1 go. So ideally I would want that row to be highlighted light green with purple font strikethrough.

Booking Status
JI Status
Date JI Sent
Attendance
Cancellation date
Chargable / non chargable Cancellations
Chargeable / non chargeable DNA
Date taken
Time taken
Event Title
Start Date
Time

JI Sent

[Code] ......

## Automatically Clear Range Based On Cell Criteria

Jan 9, 2007

I have the following Worksheet Change Event in my worksheet. The contents of range rng are not cleared.

Private Sub Worksheet_Change(ByVal Target As Range)

Dim rng As Range

rng = Range("F" & Target.Row & ":M" & Target.Row)

If Not Intersect(Target, Range("N5:N1000")) Is Nothing Then

If Target.Cells.Count = 1 Then

If Target.Value = "Yes" Then

Application.EnableEvents = False

rng.ClearContents

Application.EnableEvents = True

End If

End If

End If
End Sub

## Move Range Of Cells Based On Cell Criteria

Nov 16, 2007

I'm trying to do is loop through a range of cells, and if the cell meets a condition I want to move it and 2 cells to the right of it left by one cell.

Sub MoveRangeOfCellsBasedOnCellCriteria()
Dim myrange, cell As Range
Set myrange = ActiveSheet.Range("H2", Range("H65536").End(xlUp))
For Each cell In myrange
If IsNumeric(Left(cell.Value, 1)) _
Or Left(cell.Value, 5) = "UNIT " _
Or Left(cell.Value, 4) = "THE " _
Or Left(cell.Value, 5) = "FLAT " Then
Else
cell.Range("A1:C1").Select
Selection.Cut
cell.Offset(0, -1).Range("A1").Select
ActiveSheet.Paste
cell.Offset(1, 1).Range("A1").Select
End If
Next cell
End Sub