Increment If Condition Satisfy

Jan 26, 2007

I have a few (eg file1, file2, file3, file4, file5) files in a directory and i want to open them as individual excel file and I need to do a check on all the opened files first. If Cells(11, 4) = "important", then Count will start from 0 and workbook will be saved as wb_0 , wb_1 and so on. Else the workbook will be discarded and close. So if file2 and file4 are the only 2 files that satisfy the condition, then they will be saved as wb_0.xls and wb_1.xls.?

ChDir "C:Documents and SettingsDesktop"
For x = 1 To 5
Workbooks.OpenText Filename:= _
MyArray(x) _
, Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier _
:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, Semicolon:= _
False, Comma:=False, Space:=True, Other:=False, FieldInfo:=Array(Array( _
1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, _
1), Array(9, 1)) .....................

View 5 Replies


ADVERTISEMENT

Count Cells That Satisfy A Condition

Apr 30, 2007

I have cells in a column, which contains text and numbers. I want to count the number of cells that have value greater than zero.

I tried using DCOUNT, but I got no idea why is its not working
=DCOUNT(I15:I114,1,J5)
where the values are form I15 to I114.. and J5 contains the condition >0

Also, while I am at it.. Is there a straightforward way in excel to get the count of the max run of cells with values greater than zero.

for e.g if cells from 18 to 30 have values greater than zero , and cells 44 to 50 have values greater than zero. then I want it to return 13. i.e (30-18)

I am hoping that there is a simpler way than looping through the column in VBA

View 6 Replies View Related

Add A Time Increment When A Condition Is Met

Oct 18, 2009

I have two columns C & D. In col C (C10) a time is entered (either 13.45 or 0:33.22 format). If column D (D10) is blank then the time in Col C stays the same (13.45 or 0:33.22). However if Col D has a M in the cell (D10) I want to add 0.24 to the time in Col C (C10) eg 13.69 or 0:33.46. I have tried various formula combinations but keep getting circular reference errors.

View 6 Replies View Related

How To Increment Cell Value With IF Condition

Apr 24, 2014

I'm a structural design engineer and I want to develop my own spreadsheet to calculate required area (mm^2) of reinforcement bars in concrete to avoid concrete cracking due to temperature rise in summer. Available input are min area of reinfor (cell A3), crack width limit (A1) and calculated crack with (A2). For example.....

A1= Crack width limit 0.2mm. A2= Calculated crack 0.28mm (which is higher than the limit 0.2mm; therefore min area of reinfor A3= 1450mm^2 is insufficient to stop concrete from cracking). Now......to stop cracking, I want cell B1 to take 1450 from A3 and keep increasing it until the condiotn A1>=A2 is met and I want cell B1 to display that increament( lets say 1780mm^2). I hope you do get what exaclty I want to do in excel

I don't have much experience in Excel so I don't know anything about Macro/VBA coding etc. Can we do a simple thing like this B1=IF(A1>=A2,A3,somthing here to keep adding a value to A3??) OR do we have to give pragamming code???

If it has to be Macro/VBA, complete coding with an instruction where to write it.

NB: There are several calculations done with manual inputs within the sheet to derive the A2 (0.28mm) value

View 9 Replies View Related

Only Return Values That Satisfy Both Filters?

Jan 30, 2014

I have a worksheet that contains Country Abbreviations and related Codes. Some countries have multiple codes. How would I search for two countries and have it return me only the codes that are related to BOTH countries and not just one country.

Example:
Code Country
1 USA
2 GBR
3 HON
4 GBR
4 USA
5 HON
6 USA
6 HON
6 GBR

If I typed in or selected USA and GBR it would only return 4 and 6, not 1 and 2. If I use filters it returns 1, 2, 4, and 6.

type in the three-letter country abbreviations or be able to select them from a list and it return the correct code(s).

View 1 Replies View Related

Sum Several Cells Depending If Satisfy Several Criteria

Jul 27, 2012

I have a table with several criterias (Name of supplier, date, amount paid to this supplier). This table is my inputs. Each time I have an expense, I put down the name of the supplier and the amount of the expense and the date when it occurs.

I have another table with name of each supplier in rows and the date in column. Sometimes I have 2 amount for a same supplier for the same month. I would like this amounts sum in my table. I cant find a good formula to do it efficiently.

Obviously I can do a sum

(if(A2=B2, if(c6=c8);b10)+sum(if(A2=B2, if(c6=c8);b10)+ etc...

But I can 150 expenses per month...

View 2 Replies View Related

Summing Columns Only If They Satisfy Criteria

Jul 31, 2006

I am having an excel problem such that i have several months in a given year and I want to set up a formula where I can enter a specific year and it will return the sum of all the cells that belong to that year (see attached sheet). So basically if I have 2 months in 2006, 2 in 2007 and 2 in 2008 with corresponding values for each of those months, I want to enter a year in another part of the sheet and a value is returned to me to show me the sum of the revenue for all the months that are in that year. So if I enter 2007, it will sum both those values that belong to 2007.

The years and months are dynamic so I can't just sum the columns because in column D it could be 2006 (depending on the other inputs of my spreadsheet) or it could be 2007, so I essentially need some formula that checks the array to see if that cell belongs in a year that matches the criteria and if it does sum it to all the values that match that criteria. I have tried using vlookup, match, index but can't get it to work.

View 2 Replies View Related

Excel 2010 :: Using IF And Results That Satisfy 2 Of 3 Criteria

Apr 30, 2014

I'm trying to evaluate if 2 of the 3 criteria are met using an IF function in Excel 2010.

I have 3 columns of data. Each column has a number ranging from 0-15.
Example:
B2 = 0
C2 = 3
D2 = 4

Since B2 = 0, I'd like to have the equation return a 'Yes' because there are values greater than 0 for 2 of the three cells.

The hangup is that any of the three cells could potentially equal 0, so the equation must account for C2 or D2 being zero.

View 4 Replies View Related

How To Satisfy Multiple Conditions Using Multiple Criteria

Oct 16, 2009

I'm trying to divide my data into 6 different groups, based on 2 different criteria. First, I am not sure how to write the logical test to take 2 columns of data into consideration (using "&" and "AND" do not work; I am not sure what else to try), and second I can't figure out how to write the formula so that it can select from 1 of 6 conditions.

So, overall here is what I want:

If DL2=3 and CK2=1, then I want this to be labeled as '1'
If DL2=3 and CK2=2, 2
If DL2=1 and CK2=2, 3
If DL2=2 and CK2=2, 4
If DL2=1 and CK2=1, 5
If DL2=2 and CK2=1, 6

These 6 conditions cover all possible combinations of numbers in the two columns.

View 13 Replies View Related

Cell Equals 0 Changes When Condition Met - Leave Unchanged When Condition False

Mar 24, 2014

I am trying to perform a calculation in a cell that leaves the value 0 if before Feb 2014, changes to the value of another cell in Feb 2014 and leaves the value unchanged if after Feb 2014. I can get to the Feb 2014 value but after that month the value changes to 0.

The Cell formula that I am trying to use is as follows:

=IF(YEAR($A$3)<2014,"0",(IF(YEAR($A$3)>2014,H114,(IF(MONTH($A$3)<>2,H114,AA118)))))

A3 contains TODAY()

H114 is the cell being calculated

AA118 is the cell containing the calculated value for the current month.

View 2 Replies View Related

Multi Condition Format? Lookup And Date Condition Valid For

Aug 13, 2009

I would like to try and achive a conditional format that will require a lookup function. when the condition is met it places Yes or No into a cell and changes that row colour to red for the NO condition. and after 10 days from now the rowcolour is removed.

View 6 Replies View Related

Conditional Formatting :: Condition 1 Override Condition 2?

Feb 29, 2008

I'm having trouble with the two formulas working in conjuction with each other.

Condition 1:
=(MOD(ROW(),2)=0)*(COUNTA(3:3))

Condition 2:
=TODAY()>=A1

"Condition 1" seems to override "Condition 2"? Ever see that?

View 9 Replies View Related

How To Count Condition Based On Having Another Condition

Apr 12, 2014

So I have one sheet that needs to pull data through to another sheet (which is a stats summary)

I have a drop down list containing 4 options all of which have to be counted separately on the stats summary sheet. However I only need them counted when a value is input in another cell in that row.

For example: I select option 1 from down down menu, but I only want this to be counted on the stats page when I enter a date in the "date" cell.

View 9 Replies View Related

Return Values Of Adjacent Cells When Condition Is True Omitting Values Where Condition Is False?

Jan 15, 2014

Here's a simplified example:

ColA
ColB
ColC

Row1
A
Y
A

Row2
B
N
D

[Code] .........

I'm looking to return the values in column A adjacent to the cells in Column B equal to "Y". The kicker has been returning only the cells where the condition is true. Column C displays the desired behavior.

The closest I've been able to get is with a simple IF statement but I'm pretty sure the answer is a far cry away from there and likely requires an array formula. I'd prefer not to use VLOOKUP or OFFSET but will if the alternative is very complex.

View 7 Replies View Related

Subtract Days Between Due Date And Today Date If Condition 1 And Condition 2 Are True?

Feb 2, 2014

I need cell (O4) to display days overdue or days remaining on an assigned task based on subtracting due date (M4) from todays date, but only perform days subtraction function if (M4) is not blank and only if task complete cell (N4) is less than 100.

Have the conditional blank cell figured out, but nesting another condition for the less than 100 complete cell. So in other words, I don't want cell (O4) to subtract days and display any error, irrelevant data if there is not any due date entered or the task is entered as complete...

View 3 Replies View Related

Add A Day/increment By One

Oct 20, 2009

I want to take the date value of a cell, add one day to it and paste it to another sheet's cell. For example if Sheets("x").range("i4").value is 12/12/1999. I want to add a day to it (13/12/1999) and then paste it to Sheets("y").range("d3").value

View 4 Replies View Related

Set The Increment Value

May 15, 2006

I have a sheet with the column for time the format should be h:mm:ss, the time begin with 0:00:00 and 10 sec periods 0:00:10 ...until 50sec again in the next count wud be 0:01:00 again 10sec periods.. How to write the Macro, that automatically increse the values of minute (mm)if the ss attains 60 and increment the hour(h) value if mm get 60.

View 2 Replies View Related

Increment Using Concatenate

Sep 2, 2009

I want to write formula in cells(many cells!) using concatenate. The desired output:

In Sheet2!D1 - i will write concatenate of Sheet1!C6 and Sheet1F6
in Sheet2!E1 - i will write concatenate of Sheet1!C7 and Sheet1F7
in Sheet2!F1 - i will write concatenate of Sheet1!C8 and Sheet1F

Copy and paste formula would not do so i created a macro stated below. The problem is a can not change the ActiveCell.Formula correction.

View 2 Replies View Related

How To Increment Cell Value

Mar 14, 2013

I have a table... One of my cells is called Capacitors and the number of the cell is 202600. This is the default value. How can i increment this value?

For example:
I have capacitors in one cell with this value => 202600.

But I want to put capacitors in another cell and i want the value to be 202600 + 1 => 202601

Another cell with capacitors with 202600 + 2 => 202602
And so on...

Capacitors.JPG

View 6 Replies View Related

VBA To Increment Sheets With Same Name By 1

Aug 19, 2014

I currently have a spreadsheet that parses a HL7 message string using "|" as a delimiter. The String that comes before the first "|" becomes the sheet name (Segment). The code executes on each line of the string (Each segment is parsed). The problem is that sometimes there are multiple segments with the same name. So instead of a new sheet being created, all segments are lumped into the same sheet with that name. What I am trying to do is have the code create a new sheet for each segment and if there it is already present, add sheet name with an incremented number.

So given the sample message The MSH, SCH, PID, PV1 etc sheets are fixed. The DoHL7Parsing routine takes the line and parses it out in the existing sheet. The problem I'm having is lines that are the same such as AIP get lumped into one sheet. What I would like to happen is have AIP1,AIP2,AIP3,AIP4,AIP5 and AIP6. Each with the line parsed out. These are parsed by segment not fields. I want to be able to recognize the existing sheets and create new sheets if multiple segments with the same name are being parsed.

Sample Message:
MSH|^~&|SR|500|CL|500|20140804150856-0500||SIU^S14|5009310|P|2.3|||AL|NE|USA
SCH|10262|10262|""|S14^(SCHEDULED)^L|44950^APPENDECTOMY^C4||^^^201408081345-0500^^^^^^2||30|
MIN^MINUTES|^^^201408081345-0500^201408081415-0500|10000000034^ROISTAFF^CHIEF^O||||||||
PID|1|5000|50^^^USVHA&&0363^NI^FACILITY ID&500&L^^20140804~666^^^USSSA&&0363^SS^FACILITY

[Code] ........

Current Code:

Option Explicit

Const HL7_DELIMITER_FIELD = "|"
Const HL7_DELIMITER_SEGMENT = vbLf
Sub DoHL7Parsing(sMessage As String)
Dim vSegments As Variant, vCurSeg As Variant

[Code] .........

View 1 Replies View Related

Increment Until Value Is Reached

Apr 5, 2008

I have a value in cell P1 and is always -ve.
This value is calculated by some tedious calcualtion in some other part of the sheet.

By entering value in Cell P2, the value in cell P1 will progress towards +ve number.

What i want is a formula or Macro to increment the value in Cell P2 by 0.01
until value in Cell P1 becomes +ve...

Below is the example of my manual calculation.

When i have
P2=0 P1=-23.58
P2=0.01 P1=-14.78
P2=0.02 P1= -9.30
P2=0.03 P1= -2.92
P2=.04 P1= 1.05

Since i have achieved P1 to be positive, calculation should stop with value in P2=0.04

I have to do this for 31 column and hence manually doing it takes long time

View 13 Replies View Related

For Next Loop Increment

Feb 24, 2009

For Next Loop increment. simple For-Next Loop:

View 2 Replies View Related

Increment Within A Formula

Sep 15, 2008

I have a formula that I'd like to have increment by one, but I can't figure out how to do it.

Here's the formula:
=IF(INDIRECT("'Supervisor'!B"&ROW()-4)="Y",E12-D12,IF(INDIRECT("'Supervisor'!B"&ROW()-4)="N","0",IF(INDIRECT('"Supervisor'!B&ROW()-4)="","0")))

I'd like to have the -4 in the equation increment to -5 when I paste it to the next row without having to fix each one of them.

View 14 Replies View Related

VBA Counter With Increment Of 1

Sep 22, 2011

I have a input worksheet and in this user have to manually enter the sequence no. The sequence no. heading is not always in one cell that can be in any between any cell from D14 to D21.

I need some code which start the sequence no. with 1 and everytime I click add button. It find the sequence no. in range between D14: D21 and add 1 in the relavant adjacent cell (which can be in from E14 to E21).

See Table below

Start withColumn DColumn ERow No. can be any from 14 to 21Sequence No.1Clicked AddDesiredColumn DColumn ERow No. can be any from 14 to 21Sequence No.2DesiredColumn DColumn ERow No. can be any from 14 to 21Sequence No.previous val +1 and so on

View 2 Replies View Related

How To Increment Cells By I Value

Apr 20, 2013

The question that I have is as follows:

For i = 17 To FinalRow Step 14
'Select cells to examine based on For/Next loop Step...
Cells(i, 4).Activate
'Check for "value"...
If ActiveCell = Press Then

[Code]...

The "Cells(i, 4).Activate" statement steps my search criteria forward by the value of "i." The last thing that I want to do with this macro is to increment the value of A4, "Range ("A4").Select" and D6, "Range ("D6").Select" by the value of "i."

View 9 Replies View Related

Increment A For Loop

May 31, 2007

I want to test a condition and if false skip the rest of my for block and hit the next for:

For something = 1 to 100
if test = "false" ?NEXT FOR?
code
code
code
code
Next

I can set a lable at the Next and use a goto but that seems kinda kludgy.

View 10 Replies View Related

Increment A Cell By 1

Oct 31, 2008

How do I increment a cell by 1 when data in another cell is changed. In other words...I am logging phone calls made. When I enter the date I made a call I want a cell labeled "times called" to increase by one.

View 9 Replies View Related

Alphanumeric Increment

Jun 18, 2009

I would like to have a drop down list for cells in a row - say B1:I1.

Firstly, having the list (with only 2 selections) in these cells to place either an "A" or a "0" (zero) in a cell.

Next, if an "A" is added then a selection of a "B" or a "0".

If a "B" is added then a selection of a "C" or a "0". etc etc

If the "0" (zero) is selected and placed in the row then no more alpha but just the next number "2" available to select only then a "3" etc etc.

These would be added from left to right ie: A to H or 1 to 8.

I might be able to do this with a long formula but problem is there are 100's of rows. Maybe VBA would be more efficient?

View 9 Replies View Related

Increment Rows

Sep 22, 2006

i have created a form that links to other sheets in my book but can't get the info to stay when goto enter next lot of info.

i've been told about incrementing it but i can not work it out

View 6 Replies View Related

Increment A Link By 1 Each Row

Nov 16, 2006

I'm trying to increment a link to a file in my macro by 1 after each row. For example:

Row 1 "<a href="/ ai/grtcon/06-07-q2/gc1_e.html">
Row 2 "<a href="/ai/grtcon/06-07-q2/gc2_e.html">
Row 3 "<a href="/ai/grtcon/06-07-q2/gc3_e.html"> and so on...

I've indicated in the code in the first array where the increment should go (I'm not sure if it belongs in the array).

Option Base 1 ' sets first array element to 1, not 0
Sub makehtmlGrtCon1()
'Dimension all variables.
Dim DestFile As String
Dim FileNum As Integer
Dim ColumnCount As Long
Dim RowCount As Long
Dim LastRow As Long
Dim LastColumn As Long
Dim OpnTags As Variant
Dim ClsTags As Variant
' Array defines html tags to be used before each cell.
OpnTags = Array("<tr class=""size-smaller"">" & vbCrLf & " <td><a href=""/ai/grtcon/06-07-q2/gc" & INCREMENTHERE & "_e.html"">", _
" <td>", _ ...................

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved