Putting 2 Conditions In IF Statment
Jul 16, 2008
I would like to check whether 2 conditions are satisfy in an if statement. One condition is of data type text and it is stored in a variable calls search1 whereas the other condition is of data type date and i intend to store into a variable calls search2. Could someone tell how to put search 2 into the below code. Basically, i want it to be like
if Cell A is equal to search1 and CellB is equal to search2 then
return value that is associated with the search in cell c
ActiveSheet.Cells(r, 13).FormulaArray = "=MIN(IF(Sheet1!$A$1:$A$20=""" & search1& """,Sheet1!$C$1:$C$20))"
View 9 Replies
ADVERTISEMENT
Oct 10, 2009
Is there a way to make a cell populate certain text based on conditions of other cells without putting the formula in the cell you want to populate. So that someone could type other text into the cell if the conditions were not met?
View 14 Replies
View Related
Jan 19, 2009
Ok ive been playing about with excel for the past week to get a spreadsheep up and running so i can see the totals of some things and now its getting a little complecated for me (ive done the easy stuff lol)
Ok here is the situation and i'll try and explain what im doing as best as i can. Im trying to make a spreadsheet that shows how much a resorce can be refined so lets say in a1 to c1 i have 400 in each but i can mix a with b and b with c at the ratio of every 20 of a and c to ever 10 of b
so somewhere in my spread sheet id have the result 20 and 20 as products ato c can make 20 of product d and e i hope that makes sence?
for every 20 + 10 of a(400)+b(400) = 20
and for every 20 + 10 of c(400)+b(400) = 20
so if i had 600 300 600 instead of 400 i can only make 30 of product d of e (id have to choose)
View 14 Replies
View Related
Oct 22, 2004
I need to format the background color of a row using an if statement or something similar. If have a certain cell has a specific value I want the entire row that the cell is on to have a specific background color.
View 9 Replies
View Related
Sep 5, 2008
How can I write the equivelant of an if(and( statment in VB? What I would imaging it would look like is this...
If _________ = true
AndIf ________ = true Then
____________
End if
It seems like this should be simple, but after searching, and searching the help files, the internet, and this website, I am no closer to figuring this out.
View 9 Replies
View Related
Apr 7, 2009
I have another question with my red sox scores excel sheet. On my overview I want to be able to select any team, and view the indiviual stats against them. For the life of me I dont' know/can't find how to even do a simple yes no if statment to what the value in the drop down menu box is.
View 3 Replies
View Related
Jan 9, 2009
I don't even know if using the IF statement is the right function, but anyway. I am using VLOOKUP to complete a supply list, but of course if the supply name isn't on the first spreadsheet then the result is NA. Instead I want it to return 0.
View 3 Replies
View Related
Nov 23, 2009
why the code below is very slow with the extra if statment in it (marked with **) i have googled around and found that my for staments are correct i have tried screen updating etc. i have added a timer to see what diffrence it makes, what i have is 3 sheets 1st has about 100 rows with a number and time same as second but that only has 2 rows of the same the 3rd sheet has about 100 rows of just a number what the code does is loop through the 3rd sheet (build list) when it finds a number it looks on the first sheet to find the same number then gets the data in the second coloum and so on until it reaches a cell that says stop.
i have added a button to start this process, with the ** line in it takes 311 seconds with out it it takes 0.17 seconds
View 9 Replies
View Related
Jun 8, 2006
I have a list of codes. Some of them may be duplicated. I want to use the conditional formatting and the IF statement to highlight in a particular colour any codes that have appear twice or more. I used to know how to do this but now I cannot get it right.
View 2 Replies
View Related
Jan 11, 2009
I have been trying to get a formatting programme to work for well over a week and no matter what I try I seem destined to fail. I am trying to use an IF statement in VBA to format a cell if the result of the IF is true. The values in the cells being formatted have been generated from a VLOOKUP statment (looking at a table on another sheet of the workbook). I have tried to use conditional formatting but cannot get past the limit of 3 conditions.
Note in the code below I have values that may appear the same but to make them unique they have a single (or double) space before and after the character. Not sure if the code I have below is workable, if anyone has a better idea please let me know (its a little long winded). I am currently self learning VBA (through forums and the like) and below is the best I have come up with... however when I try to run it I only get a Run-time error 1004, application-defined or object defined error.
View 4 Replies
View Related
Sep 3, 2009
I would like for the If statment to hide multiple labels and buttons. How can I add more than one condition after Else:?
View 3 Replies
View Related
May 31, 2009
I am trying to use an IF statment to look at 2 values, 1 from a defined range and the second based on offsetting the the first to Format a number of cells with a worksheet. Affectivley if the First Value is "E" and the value two columns to the left is a Sat or Sun I wish to format the row slightly differently from if it is a weekday. (There will be an M and a L as well)
View 5 Replies
View Related
Jul 8, 2006
If you look in the file you will see a records sheets and a form sheet. I want to see if a record has been broken. All the times are in seconds and the distances are in centimeters. How can I find a certain row, compare and act based on an if statment?
View 2 Replies
View Related
Oct 17, 2007
I would like to highlight cells is two conditions are met:Cell = 0Offset(0,-1)>0I tried the conditional format wizard and entered a formula: =IF(AND($J2=0,$I2>0)) But I keep receiving formual errors, which I understand, because it appears to be incomplete formula. But I am not sure what else I need to add to the formula in the conditional format wizard
View 2 Replies
View Related
Nov 12, 2008
how do I put a space?
12345 ** =A1&B2 gives me 12345CD
but I want 12345 **
View 2 Replies
View Related
Mar 26, 2014
I have a cell in A1=(str identification is = ",) and in B1=(2). In C1 I want it to equal (str identification is = ",02) In C1 I have A1&B1
View 4 Replies
View Related
Jul 1, 2008
putting another code in the same sub.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Set rng = Range("O2:O501")
If Intersect(Target, rng) Is Nothing Then Exit Sub
If Target.Value "X" Then
With Target
.Value = "X"
With .Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 14
.ColorIndex = 3
End With
Plus this one
Set rng = Range("P2:P501")
If Intersect(Target, rng) Is Nothing Then Exit Sub
If Target.Value "X" Then
With Target
.Value = "X"
With .Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 14
.ColorIndex = 5
End With
View 9 Replies
View Related
Apr 1, 2014
There are two sheets with data:
Sheet 1
Column A - reservation number (unique)
Column B - trade partner
Sheet 2
Column A - reservation number (unique)
Column B - Hotel property
I want to put in one sheet: Reservation number - trade partner - hotel property
In another words I want to have a list of all reservations according to hotels and partners.
View 2 Replies
View Related
Feb 24, 2009
I want to be able to automatically put the calculation of one cell, into the text of another cell.
so....
Cell A3 = A2-A1
And in another cell say B3, i want to be able to write text that says "The value of cell A3 is 'A3' "
View 10 Replies
View Related
Jun 5, 2014
I want to know that are there anyway I can quickly declare the header row of the sheet into a string instead go through each one of them using dim xxxxx AS String?
View 3 Replies
View Related
Feb 14, 2014
Attached is a small sample, how to put the text from A1 to combobox1, the text from A2 to combobox2 and so on
Up to combobox6, when the form loads. but be able to change the text A1 thru A6, and no matter what text I put in A1 thru A6 the form loads with whatever text is there, is that possible?
View 2 Replies
View Related
Oct 23, 2008
I tried to put the following formula into a cell using vba, but I received alot of errors. here is the formula I am trying to put into a certain cell and I will use a variable to replace the row number in the formula
=IF(AD323<>"Open","",IF(OR(AND($AI323=TODAY(),$AJ323<>"Done"),AND($AN323=TODAY(),$AO323<>"Done"),AND ($AS323=TODAY(),$AT323<>"Done")),"Yes",""))
View 5 Replies
View Related
Nov 14, 2008
The code below places a spinbutton on the worksheet. The linked cell = F10 This works ok. The orientation is vertical and max is 100
However I would like to set the orientation to horizontal and the max value to 1500. Which commands must be added for this in the macro below? I work with Excel2000.
View 4 Replies
View Related
Feb 18, 2010
I have 2 columns of data in an excel sheet and I wish to add this to a userform so that the userform displays the 2 columns beside each other with headings, like a table. The user should then be able to select a particular row and insert it into the specified cell.
I would also like the user to select a row on the table and then be able to bring up another table depending on the row selected...basically so that the user can draw deeper into the information that they require.
View 5 Replies
View Related
May 7, 2012
I want to know if I can populate an array with variables..
For example, imagine I've declared 3 variables a, b, c.. and each variable has been assigned a value (which can change)
now I want to say this:
myArray = (a, b, c)
then I want to be able to loop through myArray and retrieve the value attached to each variable..
View 6 Replies
View Related
Nov 26, 2012
Is there any way for me to put a date in the userform? I created 3 combo boxes (day, month year). I would want it to appear as one date in one single cell in the another sheet as the date the entry was updated in the userform.
View 3 Replies
View Related
Apr 24, 2007
I would like to write a macro that would start by asking me something along the lines of, "Enter student # you want to print a report about." The # I enter would need to be stored as a variable in the VB code, and then my code would need to use the variable to do some search and replace operations. (Replace all instances of 10 (the default student number) with the variable I have specified).
I don't really know how to even start going about this. How do I get Excel to ask me for a variable, and then use that variable in code?
View 9 Replies
View Related
Nov 17, 2008
How can I stop #DIV/0! in a cell which has a formula relating to a cell which will have a number inputted but at the moment is empty, without me putting a '0' in?
View 9 Replies
View Related
Jun 13, 2013
When I try to run the macro, an error comes up saying application-defined or object-defined error. The following code is the line in which I receive the error.
VB : tool.Worksheets("ALL").Cells(row1, "J").Formula = "='[TRB Database.xlsm]TRB Database'!$I$" & A
View 3 Replies
View Related
Dec 23, 2013
I am having trouble being able to put data into a table. The data I have breaks down orders of products in crates into lots of 45 crates with a remainder.
I would like to be able to fill a table from left to right which displays the item number with the corresponding amount of crates, which seamlessly goes from one item to the next.
I have attached an example.
pallet data.xlsx
View 5 Replies
View Related