Add Two If Statements Together But One Contains Text?
Dec 29, 2011
I have two sets of data and am applying an IF statement to each one. What I would like is if the answer is positive, to have the value displayed. If the answer is negative to have a string of text displayed.
They way I have it currently set up is IF statement #1 performs the logical test. If the result is a positive number, it performs a calculation. If the answer is negative it returns a string of text.
IF statement number #2 performs a logical test and if the result is positive it performs a calculation. If the result is negative it returns a 0.
Now, this setup allows me to add the two IF statements together if the results of the logical tests are both positive or if the #1 is positive and #2 is negative. However, I get a #VALUE error is the results are both negative as statement #1 is returning a string of text.
How can I set this up so I can get the string of text as the result if the results of both logical tests are negative?
I'm trying to set up a dashboard with a table and some formulas so that I can just copy a data export into one tab and have the table perform various Vlookups, charts, etc. The trouble I'm having is that some of my cells contain a mix of text, and I'm looking for specific text only. Example:
My data source has thousands of rows, and I'm looking at the Tags column. I want to use a Vlookup that gives me the email when [Tags] contains "t2", but my search is getting confused with "impact2". Is there a formula to search for "t2", but not get confused with "impact2"? I considered using =NOT, but I don't want to exclude cells just because they contain "impact2". If there was a formula for =IGNORE, that would be marvelous. My formulas are getting longer & longer, but they always seem to break in the end.
I want to return Y or N for each row where a certain word (lets say "Apple") appears anywhere in the reference cell. Therefore in the below example the first 3 rows contain apple (somewhere in that cell) so Y is returned. I can get it to work when apple isd the only thing in the cell but not if it appears with text before and/or after it.
ie:
A B
apple Y apple orange Y orange apple Y pear N grape N
I have a workbook with two sheets 'Driver details' and 'Jan Raw Data'.
If column B Employee (Jan raw Data) matches the names in Columns B&C (Cloumn B & C, Sname, Fname) on the 'Driver details'.
If it equals a certain name i.e. Jon smith, then in empty column E of the 'Jan raw data' then copy the entire row of that individual from the 'driver details'.
Driver details
A B C D E F Emp No Sname Fname Desc Desc Reg 123 smith Jon opticar BVA MA2 456 pratt mike opticar TMA YP7
Jan Raw Data
A B C D Occup Emp Product Supp no. Crawley Smith Jon unleaded 3453534 Crawley prat mike unleaded 89797
I have three IF statements as below. the problem is if the first statement is true I want it to skip the next two statements or the result will be changed again.
DATE A B C D E 2/22/2008TRUEFALSEFALSEFALSERon 2/23/2008FALSETRUETRUETRUEPhill 2/24/2008FALSETRUEFALSEFALSETracy 2/25/2008FALSEFALSEFALSEFALSESharon 2/26/2008TRUETRUEFALSETRUEBill
On sheet two I need to list any date that has three or more true statements with the coresponding name.
I need a VBA code to create a Text file which should be in the form of DML (my scenario is to get Insert Statements for the Data available in the Excel) from Excel Sheet. And this has to be done by assigning a macro to command button where by clicking on it the DML text file should be generated. Even the syntax for the scenario will do.
My formula is not working correctly; not sure what to do. I use this same formula with numbers and it seem to work, but only have 8 IF statements as well. This example below doesn't even work with only 8 IF statements. -------------------------------------------------- What I am saying below is = If E3 = a swat team (i.e. EO-Deal Processing-Prescreen) then please enter "Chumbley" and so on. For anything else put an na or n/a for blanks or swat teams that I haven't lised in the criteria. ---------------------------------------------------
I made a combo box where the user selects a part in a combo box and I want the part selected to be stored in a certain cell. The first selection would be stored in C15 and if thats not empty then in D15 and if thats not empty then in E15 and if thats not empty then in F15.
Dim m As Integer m = cboPart.ListIndex
If m = 0 Then If IsEmpty(ActiveCell.Range("C15")) = True Then ActiveCell.Range("C15") = cboPart.Value & vbLf & "Name: " + txtName Else ActiveCell.Range("D15") = cboPart.Value & vbLf & "Name: " + txtName End If Else If IsEmpty(ActiveCell.Range("D15")) = False Then ActiveCell.Range("E15") = cboPart.Value & vbLf & "Name: " + txtName Else ActiveCell.Range("F15") = cboPart.Value & vbLf & "Name: " + txtName End If
End If
When I run this if-and-else statement it stops storing the selected data after the following:
If IsEmpty(ActiveCell.Range("C15")) = True Then ActiveCell.Range("C15") = cboPart.Value & vbLf & "Name: " + txtName Else ActiveCell.Range("D15") = cboPart.Value & vbLf & "Name: " + txtName End If
I got a 2 columns (A:B) with values in workbook1 (survey2.xlsm)
I want to open a sheet named according to values from column A wb1 in workbook2 (du_database2)
And I want to fill in the offset values (column B) in the aproppriate sheet
I wrote this sub for it. I am having troubles with the for each statements (how do I set them up properly?). The script itself hasn't been checked might also been wrong there.
VB: Sub copytest() 'by J Dim ws As Worksheet Workbooks.Open "survey2.xlsm" Application.Workbooks("du_database2.xlsm").Activate
I'm using vlookups within IF statements to look in a number of various speadsheets depending on what the lookup value is.
So for example,
Formula:
This works well enough however I need some look up values to look in multiple spreadsheets as the data is split out between several spreadsheets. So for example, if B1=Hello I want to vlookup to 2 different spreadsheets.
I know I could do two instances of a vlookup within the formula, both for "hello" but looking to different spreadsheets. But doesn't this mean that if the first vlookup finds the value, the second one will overright it with an "#N/A" if it doesn't find it?
I need to write IF statement with 4 criteria, or at least I think IF will do the trick. It would be difficult and not very visual to describe my question here, therefore I have attached a dummy workbook with the comments. Basically I have got 2 values in 2 columns. Next 2 columns will hold letter "x". There are 4 possible variations how "x" will appear in those two columns: first, second, both or none. So depending where the "x" is, I need to return one of the 2 values.
I have various 6 x 6 blocks which contain just numbers, in another part of the spread sheet I have a 1 x 6 block of numbers. What I need to do is to check whether any of the numbers in the 1 x 6 block appear in any of the 6 x 6 blocks.If that does occur then I want to make a specific cell increase by the times that the match happens.using HLookup but just got errors and the If Statement, although did work, went on and on and on.
I am new to this thread and hope you can find the time to help me. I am using excel to look up data manually entered in Widgets, Gidgets, Lidgets fields to find an exact match in an array and return the value in "field 1" with no luck. My lookup formula should return "9" from the Field 1 column.
I need to write an IF statement that exceeds the 8 statement maximum. Basically, what I want to say is: IF(U2>K2,1,IF(U2+V2>K2,2.........all the way up to U2...AM2>K2,19)
I've attached the workbook to make this easier. If you look at the file master.xls you will see 2 tabs. On the Tool tab I've highlighted some blue cells and some rose cells. If you look at the blue cell G68 there is a long formula that reads up to 3 cells from the Specs tab and then plugs in the correct data from the blue cells on the right side of the Tools tab page. I need the rose cell F69 to do the same thing only with the data from the rose cells to the right. When I try and duplicate the fromula from G68 into F69 I get errors. I hope I made this clear enough. The formula in G68 is long, is there a way to shorten it? Also sometimes in this workbook when I try to type a formula in a cell I get the text I typed instead of the formula. For example I might enter in A1, =B2. Instead of getting the data from B2, it reads =B2. I've looked at how the cell is formatted but can't get it to work.
I'm hoping someone can help me sort this out. I have a formula I need te determine if a TAT was 'met' or 'missed' and it has multiple criteria. Here is the formula I am trying to get to work:
I've been able to get separate pieces of the formula to work correctly, example: =IF(AND(F2<>"n/a",I2="Amendments",F2<=3,OR(D2<=G2)),"Met",IF(F2="n/a","n/a","Missed"))
but when I try to combine everything into one string I can not get it to work.
I know the concept of Case statements sounds simple, but trying to write it in my scenario seems a lot more difficult than I thought it would be. I have three columns with an unspecified number of rows (which are generated from another macro). Lets say those colums are C, D, E, and they should be strings because my criteria are based on the number of digits contained in each cell. I want to add a certain number of periods to a given cell, then add that string onto two other cell strings, and form one combined string in a separate cell.
Basically I want to sort of Concatenate the cells into a given cell in column F for each row, but there are many conditions. If the cells in column C contain 3 digits, I want to add one period "." onto the original string. If it has 4 digits, then I add nothing, and then, add that cell to the string in cell D, and then Cell E. [It is like the function Concatenate(C1&".",D1&"..",E1)]. Cells in Column D have 6 criteria, and cells in Column E have zero criteria.
And I need this to loop down until it reaches an empty row or cells.
I have a spreadsheet which I need to write a formula which looks at a field and if the number in the field starts with either 55, 50 or 78 it populates my selected field. This is an example of what I am trying to do :
I've done a few searches and found the 2 macros I need. They are:
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 4 And Target.Count = 1 Then If InStr(1, Target.Value, "REL", vbTextCompare) Then If IsEmpty(Target.Offset(0, -1)) Then Target.Offset(0, -1).Value = Date Target.Offset(0, 1).NumberFormat = "mm/dd/yyyy" Target.EntireColumn.AutoFit End If End If End If End Sub
and Private Sub Worksheet_Change(ByVal Target As Excel.Range) With Target If .Count > 1 Then Exit Sub...........................
I know very little about VBA. The first program I use to enter a static date to the cell (Column C) to the left when I type "REL" into a cell (Column D) and the second will be used to enter a static date into the cell next to the one above (Column B) when I type anything into a cell (Column E).
They both work individually but I am now trying to compile them together and get the compile error (Because they have the same worksheet_change name). I do not know how to rename or make them in the same.
I would like to use an if statement to fill in data in one column - I have 1 lookup table with 6 columns and a spreadsheet with multiple columns - basically I want to ask if a cell=13 go to my look up table"res type" A$2:$B$220 if not go to the same lookup table but go to E$2:$F$220 this is what I wrote but it is not working: ...