Check Multiple Cells, Fire Macro Based On Result

Jul 14, 2007

I have three cells where a user will input data, in some cases (2T Weld Condition) they will only enter in B12 and C12, but in the case of a 3T weld they will also enter data in the D12 cell. I then use a formula to check for the thinnest material and that is entered into another cell with a formula, B14. I then need to check the value in B14 to verify if it is above zero, but below 0.65 (mm). If it is then I would like to have a message appear on the screen notifying the user that they are outside the acceptable range.

I cannot figure out how to use the information in cell B14 because it is a formula and my code only works with a direct value. The code I am using works if I point to one of the three input cells, B12, C12 or D12. How do I use the information in B14 to work with the code below.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$12" Then
If Target.Value < 0.65 Then
Run "MyMacro"
End If
End If
End Sub

MyMacro loads a userform with buttons, etc.

View 4 Replies


Return 1 Result From Many Based On Multiple Condition Check Of Cell Value

May 21, 2008

I am trying to write a formula to figure out Body Mass Indexes for certain age groups and whether or not they fall into a High or Low risk category. So, I am trying to write a formula that does the following. I have 3 columns, Gender, Age and BMI. I need the formula to do the following.

IF Gender = M AND Age >18, <39 AND BMI >7%, <19%, Then return an "L" into 4th column
IF Gender = M AND Age >18, <39 AND BMI >19%, Then return an "H" into 4th column
IF Gender = M AND Age >40, <59 AND BMI >14%, <23%, Then return an "L" into 4th column..............................

View 2 Replies View Related

Fill Multiple Cells Based On The Result In One Cell?

May 31, 2014

When I enter barcode X in cell A1, I want B1 to say supplier and C1 to say product name and D1 to say package quantaty etc.

And if I enter barcode Y in cell A2, I want B2 to say different supplier, and so on, hopefully you get the picture.

View 7 Replies View Related

Creating A Macro To Create Multiple Check Boxes Linked To Different Cells

Jun 24, 2014

I am trying to create a macro that will create a number of check boxes, which are linked different cells. I have had some success in creating multiple check boxes and having them at the destination I want the problem is that instead of linking to different cells they are all linked to the same cell. I have attached a sample workbook SAMPLE.xlsx

View 1 Replies View Related

Multiple IFs To Display One Result Based On Multiple Criteria

Mar 18, 2014

I've got a matrix combining actions on the left hand side (Col A) and owners on Cols B to F. I have drop down list for each action/owner combo: N/A, OK, KO, TBD.

Owner #1
Owner #2
Owner #3
Owner #4
Owner #5

Action #1


I would like to create a formula in Col G that does the following:If any of the values in columns B to F equals OK, then OKIf any of the values in columns B to F equals KO, then KO I've been tinkering with multiple IFs and quite rightly got bogged down as too many criteria to take into account...

View 4 Replies View Related

Macro Causing Custom Function To Fire

Sep 3, 2007

I have a large file, part of which amongst other things calculates life expectancy from a range of q(x) values (proportion of people that die moving from age (x) to (x+1). Life expectancy is calculated using a user-defined function (below).

My problem is that whenever I run a macro that changes the file, even parts of the file that don't affect the cells using the life function, it jumps into the life function. (An example: copying and pasting values on a different sheet). This is a hassle when stepping through other macros using F8, not to mention the time cost.

Some further possibly necessary information: one macro uses the GoalSeek application to set the target cell that contains the life function

By the way, this didn't use to happen in older versions of a similar file. When running the GoalSeek macro to change target life expectancy it did, but not for any other macro.

Here is the function:

Function life(data As Range)

' Aims to calculate Life expectancy from Qx values
' It assumes first value of Q is Qb, then Q0 to Qmax

Dim Nobs As Integer
Dim j As Integer, i As Integer
Dim q() As Double
Dim L() As Double
Dim T As Double, le As Double

Nobs = data.Rows.Count

View 9 Replies View Related

Return Result Based On Multiple Criteria

Sep 19, 2009

I have been trying this for hours but to no avail.

I have a table with 4 columns headers
Name, Amount, Loc and Code

The name may look like ABC 1, ABC 2....
The Loc may be in US, GB...
and the Code may be AA, BB

I need to return a result "Y" if the sum of the amount is > 100
and "N" if the sum of the amount < 100 based on the conditions
of the following :if

1) Name is the same entity, such as ABC 1 and ABC 2 and
2) Loc is the same, US..and
3) Code is the same

I have attached a sample to illustrates the result

View 10 Replies View Related

Formula For Students - Result Based On Multiple Criteria

Aug 5, 2014

How to formulate results of students in excel sheet.

From the attached picture (capture1.jpg) of the excel sheet - The rules of exams are:

1. if candidate scores 50% in all 4 papers, PASS and proceed to next year
2. if candidate scores 50% in 2 or 3 papers + borderline fail in 1 or 2 papers, VIVA VOCE exam for the borderline failed paper (Definition of borderline fail is candidate scoring 45 to 50 marks)
3. if candidate scores 50% in upto 2 papers + borderline fail in more than 2 papers, RE-EXAM
4. if candidate scores 45% in 2 or more papers, FAIL and repeat the year

The rules are in the attached picture flowchart.jpg

I am unsuccessful in writing a formula for such multiple criteria...

View 12 Replies View Related

Run Macro Based On SUM Function Result

Jan 27, 2008

i have the formula "= sum(A1:A10)" in cell A4 & would like to call macro when the value changes. The code i'm using below work's if I manually type in a value, but isn't working with the formula.

Private Sub Worksheet_Change(ByVal Target As Range)
' Checks for cell value change
If Intersect(Target, Range("A4")) Is Nothing Then
Exit Sub
' If cell value change, calls msgbox based on criteria
If Range("E4").Value = "C" And Range("A4").Value > "30" Then
Call MsgBox1
End If
If Range("E4").Value = "F" And Range("A4").Value > "38" Then
Call MsgBox2
End If
End If
End Sub

View 4 Replies View Related

Multiple Calculations From Different Cells With Result In One Cell?

Mar 19, 2014

I realised that the screenshot attachment makes much more sense than trying to show within post.


BILL £4.00 £4.00 £48.00
BILL £120.00 £10.00 £120.00
BILL £260.00 £21.67 £260.00
BILL £12.00 £12.00 £144.00
BILL £19.00 £19.00 £228.00
BILL £14.63 £14.63 £175.56
BILL £550.00 £45.83 £550.00
BILL £94.00 £94.00 £1,128.00

For my bills I want to work out first the monthly cost e.g. monthly(B) figure OR annual (C) /12 - and give the result in column (D)
And then work out the annual cost e.g. monthly (B) *12 OR annual figure - and give the result in column (E)

So if there is no figure in the monthly column (B), the calculation will be dividing the annual column figure by 12 and vice versa, if there is no figure in the annual column (C) then the calculation will be multiplying the figure by 12

This is probably a very simple calculation to do, but I am struggling to make sense of calculating results from different columns to give a result in the same cell.


View 1 Replies View Related

Hide Cells Based On Another Cell Result

Jan 12, 2008

I would like to gray out or hide contents of a series or group of cells when a particular cell has a certain result. i.e. if cell A1 is <5 I want cell rows 5 thru 10 to be hidden or grayed out.

View 5 Replies View Related

Color Cells Based On Average Result

Aug 2, 2008

I have a cell with the following formula: =IF(ISERROR(AVERAGE(A2,C2,D2)),"",(AVERAGE(A2,C2,D2)). I'm using this formula because I want to average the selected cells, but if A2,C2, or D2 are blank I don't want it to return the # DIV/0! error, hence the "ISERROR" part.

Now... I want to conditionally format the cell with the above formula in it so that if it is equal to or greater than 80% it's green. Here's the problem, the conditional format colors the cell green if it is blank too. How do I stop that?
Below is an attached spreadsheet to show what I'm trying to do.

View 3 Replies View Related

Function To Compare Multiple Cells And Provide A Result..

Jan 6, 2010

I need to look at 2 different cells and have a 3rd cell provide a number based on the first two cells.

Column A: either 1 or 2 (2 results in +5)
Column B: either yes or no (yes results in a +5)
Column C: function would result in either 0, 5, or 10.

View 3 Replies View Related

Macro That Will Auto Color Multiple Cells Based On Data Displayed In One Cell

Jan 7, 2013

I am trying to find a way to write a Macro that will auto color multiple cells based on what data is displayed in one cell. The cell I want to reference is a vlookup cell.

Basically this is a part label. And depending what part is selected from the list my vlookup will display its position on a vehicle(i.e.. FR, FL, RR, RL, Etc..). So if vlookup comes back with FR I want the various cells on the label to be orange, etc..

ALSO: if there is a way to embed it so it does this automatically (rather than run the macro each time).

View 7 Replies View Related

Run Macro Based On Result Of IF Function/Formula In Cell

Sep 14, 2006

how to run a macro from an IF function, if the function is true macro 1 runs if the function is false macro 2 runs.

View 2 Replies View Related

Conditional Formatting Based On Multiple Check Boxes

Sep 19, 2013

Basically I have a list of companies each with five corresponding check boxes in different cells. I want the cell with the company name in (or just a symbol in the cell) to appear Green, Amber, Red when 5, 3-4, 1-2 of the boxes are checked respectively.

View 3 Replies View Related

Automatically Format Range Based On Formula Result Of Cells

May 16, 2009

The following code works perfect but the "change" event is only triggered when working directly on intersect range. Tried using the "calculation" event but could not figure it out. This is what I want:

1) To replace the code provided below using the calculation event
2) To only trigger the event for the row(s) where the new value was generated, not for the whole "For Each" statement
3) To use one single code for all worksheets, instead of copying the code in every working worksheet on the workbook, if feasible
4) And I would like a "second alternative", where the user of the workbook can click on a button and trigger the event on every row on the workbook that has a non empty cell within the intersect range, assuming that the intersect range column is the same for all worksheets

Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range, d As Range, fc As Long, bc As Long, bf As Boolean
Set d = Intersect(Range("I:I"), Target)
If d Is Nothing Then Exit Sub
For Each c In d
Select Case UCase(c)
Case "C"
fc = 1: fb = True: bc = 4
Case "O"
fc = 2: fb = True: bc = 3
Case "D"
fc = 2: fb = True: bc = 46
Case "G"
fc = 2: fb = True: bc = 5..................

View 4 Replies View Related

How To Check Multiple Cells Have Same String

Jul 9, 2013

I want to check if cells C1, D1 and E1 contain the same name. For example if the cells all contain the 'Joe Bloggs' (or whatever the name variable happens to be) then cell F1 should say "Yes", else "No".

View 1 Replies View Related

Check For Equal Cells With Multiple IF Statements?

Aug 21, 2014

I am trying to check if the dates are equal with multiple if statements! Macro works great if first date is wrong, but if the 2nd or third date is not unequal it does not work anymore.

really tried to do it myself but unfortunately

I added an excelexample

Date in E3 is different (if you type in other date in cell b3 macro does work partially).

View 1 Replies View Related

Check Conditions In Multiple Cells With One Cell

May 22, 2006

=AND($AE$2:$AE$10<=$F$2:$F$2000;$AE$2:$AE$10>=$E$2:$E$2000) With this I am checking for conditions to be true or false

Lets say I am checking AND(AE2 <= F2 ; AE2>=E2) this tells me if date in cell
AE2 is smaller or equal to Cell F2, but how can I set this fromula to check if all the cells from F2 to F1000 are equal to AE2 so If I write date into Cell AE2 it checks all dates from F2 to F1000 and check if condition is true or false
(and if I write date in cell AE3 it should check all the dates from F2:F1000, if date in AE3 is in this range)

View 9 Replies View Related

Creating Multiple Check Boxes Macro

Nov 4, 2009

I would like to be able to create multiple check boxes that will accomplish 2 things.

1. When Checked will display a date in the cell one column to the right.
2. When checked will change colors

Secondly, since i will need to make several hundred of these I would like a macro that will allow me to define how the check box is to behave and then have a macro which will allow me to define all of the settings and then input the number of check boxes that I want and it will create that many boxes.

I recall seeing a macro on here some time ago (at least 1 month prior but no more than 6 months prior) which allowed you to type into a form how many check boxes or option boxes you wanted to create in your workbook, and then it would create that many.

View 14 Replies View Related

Assign 1 Macro To Run Multiple Check Box Controls

Sep 15, 2007

I have over 100 checkboxs on an excel sheet. This sheet will be duplicated 25 times in this workbook.

How can I move this code so its not on each sheet.

Private Sub Aerial_Click()
UG = False
Apartment = False
Range("L68") = "Aerial"
End Sub

View 9 Replies View Related

Uncheck A Check Box Based On Changes In Merged Cells

Dec 18, 2008

I would like to program my check box to uncheck on any changes in Cell C4.
(C4 is part of a merged cell)

View 3 Replies View Related

Format Based On Three Different Cells - IsError Check

Oct 30, 2013

I have a worksheet that I want to format based on three different cells. I had it set up with the following:

For i = 2 To LR

If Cells(i, 13).Value = "Price Mismatch" Then
Cells(i, 1).EntireRow.Interior.ColorIndex = 39

[Code] ........

Worked fine until one of the cells had an error in the result, I want to have this row colored also. I altered the first check to :


If Cells(i, 13).Value = "Price Mismatch" Or IsError(Cells(i, 13)) = "True" Then

I have tried multiple variations without success. I need to have the row colored if the value in the cell on the row in column 13 = Price Mismatch or is an error.

View 4 Replies View Related

Excel 2003 :: Cell Result Based On Range Of Filled / Empty Cells

Apr 3, 2014

I'm stuck using Excel 2003 to auto-populate a cell.

I have a range of dates in five consecutive columns called:

Phase 1, Phase 2, Phase 3, Phase 4 and Phase 5

I enter the date that 'Phase 1' starts under the first header. Once Phase 2 starts I enter a date under 'Phase 2', and so on to Phase 5.

Each phase is consecutive to the next so will always be filled in from 1 to 5.

I want to create an additional column called 'Status' that shows the Column Title of the last phase with a date in it. For example, if Phase 1 to 3 had dates but 4 & 5 were blank, "Phase 3" would be displayed in the 'Status' column.

I've tried nesting some ISBLANK functions without any luck.

View 4 Replies View Related

How Do I Check Cells In Multiple Work Sheets With SUMIF

Jul 19, 2007

How do I get a function to check cells on multiple work sheets.

For example this function searches for the word "hello" in cells, A1 to A50 and then adds up the number in the corresponding cells where "hello" is found from C1 to C50:


Two questions:

01) How do I search the same cells in two further work sheet, "Sheet2" & "Sheet3"?

02) Is there a way to search every cell in an entire work sheet?

View 9 Replies View Related

Check Cells Value Before Macro Run

Jul 29, 2007

I have completed a formulation and included in a macro but I dont know about coding to check for specific cell string values before macro will take off. I want macro to check that if specific cell text are not matched, use MsgBox to display the wrong versus correct cell string text, then vbOK to exit macro. Also, if Range(B2:G2,J2) are completely blank, use MsgBox to display "missing data", then vbOK to exit macro.

cell B =REQ
cell C =SS
cell D =Current Stock
cell E =PO
cell F =Sales Order
cell G =In-coming
cell L =unit cost

If these cell texts (U or L case will do) are in their specific cells, macro will proceed. If either one or some of these cell texts are not matched, display MsgBox of the wrong and correct cell texts. Then button OK to stop macro run. If Range(B2:G2,J2) are completely blank, use MsgBox to display "missing data", then vbOK to exit macro.

View 3 Replies View Related

Result Based On Existance: If Coulmn Contains A Anywhere Then The Result Should Be A

Dec 4, 2009

I have 4 categories A, B, C & D. These are in desending importance, means A is most important and D is least important. Now there could be many A, B, C & Ds listed in a column. The challange is if coulmn contains A anywhere then the result should be A. If A is absent, then search for B, if present anywhere then display the result as B. It doesn't matter how many times A or any character is listed in column. I am attaching a sheet for better explanation.

View 4 Replies View Related

Macro To Check Values On Two Cells Should Be Equal

May 2, 2014

I have cells that they're values should be equal B6=B11, B7=B12, B8=B13, E6=B14, E7=B15, E8=B16, I want a macro that if the values are not equal then the background should be RED and a pop up message "The values should be equal".

View 9 Replies View Related

Loop Macro To Check If Cells Not Empty

Jun 27, 2014

Column 'N' and 'O' will be used for inputting information and will never be hidden

Column 'E' through 'F' hold information, however the user will have hidden all but one of columns 'E' through 'F' before running macro

Once the user initiates the macro, the program will detect which column in 'E' through 'F' is not hidden

The macro will then start at row one of the unhidden column and loop down looking for the text 'Req' (not including ' )

If the loop finds 'Req' it will search in column 'N' of the same row for any data at all
If it finds data in column 'N' for that particular row, it will check column 'O' of that same row for any data at all
If it finds data in column 'O' also, then all 3 parameters have been met

The loop should continue checking for these 3 items through row 500

If the loop determines that for every 'Req' found in the unhidden row there is data in the corresponding column 'N' and 'O' a message will appear that says 'Checklist Complete"

Upon closing the message box, the file should save and then exit

If the loop determines that for every 'Req' found in the unhidden row, there is not always data present in column 'N' and 'O' the message box should appear and say 'Checklist Incomplete'

In the same message box, it should provide a list under 'Checklist Incomplete' that provides the text found in column 'D' for each row where it failed the test of having 'Req' in the unhidden row and data at all in column 'N' and 'O'

That last part will give the user a tool to see where they might have forgotton to enter data.

View 3 Replies View Related

Copyrights 2005-15, All rights reserved