Vba Conditional Logic

Apr 24, 2007

I have 3 ranges in an excel sheet
col 1 range contains a numeric value ("1" or "5")
col 2 range contains a string value ("left" or "right")
col 3 range contains a string value ("a" or "b" or "c")

example: I am trying to get a total count if col 1 contains either a "1" AND
col 2 value is "left" And col 3 value is "a". Note: If col 1 is blank (" ") then the rest of the row is irrelevant. See attachment

View 4 Replies


ADVERTISEMENT

Conditional Logic Based On Name Of Worksheet

Apr 24, 2009

I need to put a macro in the toolbar which copies data from another worksheet. The trick is I have several worksheets and want the one macro to pull data from different columns based on which worksheet is active. So I need to test the name of the active worksheet in my logic.

View 5 Replies View Related

Comparing Multiple Ranges With Conditional Logic?

Apr 23, 2012

[1] compare (row) ranges across two columns with an unequal number of rows (column A [number] to column C [number])
[2] save each result of [1] where there was a match in column B
[3] for each row where there was a match (now stored in B), compare the value from the same row in column D (date) with the same row of column F (date), and store the result in column E
[4] count and message box the final number of matches from column E

Data Example:

A B C D E F
----- ----- ----- ----- ----- -----
12345 match 12345 11/1/2011 match 11/1/2011
77777 34345 ... ...

A and C numbers match, so check same row date in D that does match date in E, place "match" in E, then count and display.

Sub other()
Dim range1, range2, range3, range4, range5, range6 As range
Dim x As Variant, y As Variant, z As Variant, a As Variant

[Code].....

View 1 Replies View Related

Excel 2010 :: Conditional Formatting Inconsistencies - Seems Beyond Logic

May 30, 2012

I've run into an issue where conditional formatting is working correctly 98% of the time, but 2% seems beyond logic. Basically if I have more than 120% of Stock Limit on hand I want the cells to turn green. To do this I entered the following Conditional Formatting formula in cell D4:

HTML Code:
=((D4-$C4)/$C4)>=$E$1

I copied the formatting to all the other cells in the range, and most are colored correctly. This is what I get:

Sheet1

ABCDEFGHIJ1

Overstock Threshold: 120%

2Location:ABC

3ItemNameMin Limit5/1/20126/1/20127/1/20128/1/20129/1/201210/1/201211/1/20124123Part A2-328765435234Part B35-2-21212489898

As you can see, it works correctly for the most part, however some cells, such as cell H5 in the example, that should be colored by they aren't.

My first thought was that this is an issue with the reference, because as I examine other cells it doesn't look like conditional formatting formulas are updated relative to that particular line, however that is the same case for my red formats and those are correct. I have over 50,000 rows so creating a new formula for each row certainly isn't the preferred option, neither is writing a macro to manually color them because of the processing time. I'm using Excel 2010.

View 2 Replies View Related

If/And Logic Functions

Jan 25, 2007

There are three situations that should yield the answer "overdue" and a fourth and fifth situation that should yield an answer "on target". I'm new to functions and have spent SEVERAL hours on this

{=IF((G4<>0,F4<$g$1="Overdue")+(F4<G4="Overdue")+(G4<>0,F4>$g$1="On Target")+(F4>=G4="On Target"))}

View 10 Replies View Related

Common Value But Different Logic

Nov 6, 2011

Although the "Trip Sequence" is same , but I need to separate the Trips if the difference between the "1ST TIME " is more than 3 hours keep the first "Trip Sequence" unchanged , then by either adding a prefix or add 2000000 to the second "Trip Sequence" and 3000000 to the Third, so forth so on until all the rules are applied ( assuming more than 3 Trip Sequences could be also allocated in the database ).

Data Base
TRIP#

1ST TIME Trip CodeCount1st Stn2nd StnTrip Sequence
XXX07411230$AA3270CDGFRA3270001XXX1108400$BBK142LHRAMS3270002
XXX0740705$CC32124AMSGVA3270002XXX01441150$DDA98CDGDUB3270003
XXX10321030$MM1947BRUAMS3270004XXX05101410$VV19132AMSGVA3270004
XXX05111835$VV1984GVACDG3270004XXX11451430$KK31133FCOATH3270005
XXX10471700$KK31132ATHCDG3270005

In the above examples , The "Trip Sequence" is same 3270004 but the "1ST TIME" is more than 3 hours difference:-

I want to be able ( ONLY IF "1ST TIME" is in access of 3 hours while the Trip Sequence are same , I want the results as follows:-

TRIP#

1ST TIME Trip CodeCount1st Stn2nd StnTrip Sequence
XXX07411230$AA3270CDGFRA3270001XXX1108400$BBK142LHRAMS3270002
XXX0740705$CC32124AMSGVA3270002XXX01441150$DDA98CDGDUB3270003
XXX10321030$MM1947BRUAMS3270004XXX05101410$VV19132AMSGVA5270004
XXX05111835$VV1984GVACDG6270004XXX11451430$KK31133FCOATH3270005
XXX10471700$KK31132ATHCDG3270005

View 9 Replies View Related

IF Statements And Date Logic

Dec 8, 2008

I am trying to calculate the number of forecasted hours worked per week for each contractor based on their allocation to the project and also based on a 37.5 hour standard week.

I am using a formula which was previously provided to me for another problem but theoretically should share the same logic. The formula works only when a contractor is forecasted to work for a full week. If there is a contract which finishes mid week the formula returns a weird value. Also another problem is that if a contract is starting on the 12th of January, it still forecasts a full week for the week commencing the 7th of January. I have attached a spreadsheet for everyone's reference.

View 4 Replies View Related

Logic With Multiple Conditions

Jan 15, 2009

I want cell B to be blank if 1 of 2 different conditions are met. If Cell A is blank then so too should be Cell B. If cell A contains data, then I want cell B to perform a formula $D$1-E6.

However, if Cell C contains data then Cell B should return to a blank status.

View 6 Replies View Related

Spreadsheet W/Logic For IT App Deployments

Aug 13, 2009

Sample spreadsheet attached to provide a visual of what I'm trying to accomplish.

Issue: Need to identify which userid's can be deployed and which userid's can't

Detail: In the attached spreadsheet, column A would list all userid's that the project team wants to deploy an application to. Let say for this example that they want to deploy Adobe Acrobat Pro v9 to replace Adobe Acrobat Pro v7. In my actual spreadsheet, there are 1307 userid's in Column A.

As a result of meetings, we have identified 11 Functional Teams that CANNOT have their users upgraded to Acrobat Pro v9. Using internal LDAP look up tools, I am able to generate a list of userid's for each of those 11 Functional Teams. The numbers vary. Again, in my actual spreadsheet so far, Functional Team #1 has 600 userid's, FT#2 has 2700 userID's, FT#3 has 6700 userid's, etc. I'm not done generating the userid's for each functional team but I know I need assistance once I'm done!! LOL!!

Using Column A, I'd like to see if that same userid exists anywhere in Columns B thru L. If it does, then that specific userid cannot be deployed. I would like that userid to be displayed in column N. And in Column O, I'd like to display the name or names of the functional team that this userid is a member of. It could be multiple teams. This will help me identify users that have multiple functional team memberships. Useful data for future deployments.

Using Column A, if a userid does not exist in Columns B thru L, then that userid can indeed be deployed. I'd like to get that userid displayed in Column M.

View 10 Replies View Related

How To Find The Next Occurance Of A Logic

May 7, 2009

In the columns below B is just 95% of A. What I want to do in column C is to put the maximum value of B over the range that corresponds until the value in A is less than that. For example for my 1st run the value would be $1,125.68 because this is the maximum amount before you fall below that in column A, or in this case hits $1,106.40. I want to be able to perform this automatically down the line (expanding the range until the logic test is true) but can't figure out how to do this. The formula would basically be the max of the range in Column B is > Column A until this is not true, then return the max in Column B for entry in Column C. Then in Column D I would run an identical analysis but return the Row identifer for the dataset.

View 11 Replies View Related

Concatenate & Indirect Logic

Sep 21, 2009

I need your help on the attached sample sheet. I have used the concatenate & indirect combination logic to get the desire comments as outcome , but my problem is that I have 300 rows & 30 sheets in a workbook with this logic , it is increasing the size of my file as I have a total of 30 sheets with same logic. I need it in every sheet. If there is any other alternative or solution.

View 14 Replies View Related

Logic For Sorting Values?

Feb 17, 2014

I have a dump which looks like below sample:

3
3
2
2

The actual dump will have around 200 - 500 rows of data.From the above I need to manually group them which are similar. E.g. the data of (3, 3, 2 , 2) in row 1 & 2 are matching, so they will be group 1 & row 3 will be group 2, row 4 will be group 3 respectively.

The sum & sort did not work as sometimes the data with the same range are not in same order. simpler logic/VBA code if any, which will automatically put group numbers if the data in two rows are exact match.

E.g of the output below for the above data:

Group No.

1
3
3
2
2

View 6 Replies View Related

Head Around Sumproduct Logic

Nov 26, 2008

I am trying to get my head around sumproduct. So I had a go at trying to use the following formula to add data in odd columns.

=SUMPRODUCT(ISODD(COLUMN(A1:J1))*(A1:J1))

The formula below works but I don't understand whats wrong with the one above. Can anyone please explain how I would use isodd to achieve this? What am I doing wrong?

=SUMPRODUCT((MOD(COLUMN(A1:J1),2)=0)*A1:J1)

View 9 Replies View Related

Group Numbering Rows By Logic?

Mar 27, 2014

I tried to make attached worksheet self-explanatory. find attached.

Basically, I want to number group of rows based on a logic (blank A,B, and C columns)

inincubus.grouprows.xlsx

View 3 Replies View Related

Logic With Multiple Cells, Selecting Between The Two

Jan 16, 2009

I'm working with Excel 2003 on a peice for work that requires users to enter their current grade and, if they have one, a temporary grade. Another sheet in the workbook needs to add together all those in a certain grade and who answered a certain way to a drop-down table, so that I can use it to figure out what percentage of staff are of each grade. At the moment it looks like this:

=SUMPRODUCT(--(Work_Data!F2:F9827="Grade 1"),--(RIGHT(Work_Data!K2:K9827,3)="Top 25%"))

Which only draws information from the current grade (column F) and the answer they give (Column K). What I can't come up with is a formula that will only take column F as long as column G hasn't got a temporary grade, but if it does have a temporary grade will take column G instead.

View 4 Replies View Related

Summing Multiple Rows Using Logic?

Feb 3, 2009

I'm going nuts trying to figure out what formula I could use to give me totals in columns Q and R of the attached file. Basically, in the Weekly Totals column, I want to populate how many Customers and Bags were handled according to each ship name (the data is in the table to the left). Any suggestions would be GREATLY appreciated, I'm taking stabs in the dark but am not coming up with anything that works.

View 6 Replies View Related

Several Formulas In One Cell + Logic Fail

May 3, 2009

According to what I've read so far in this forum, this will be cakewalk for you guys to find out of (or at least so I hope.. :-) I don't know much about Excel, and what I do know is just logic sense, and a bit of common math.

My problem is in a sheet I use for my personal economy. (I'm a neatfreak, and a nerd...) The logic of my sheet is that I seperate the different type of monthly expenses, and sum them individually. The way I do this is that the A Column identyfies an expense (where 1 = rent, 2 = food, 3 = gas etc) while the C column is the expense itself, Example:

A B C
On account 500
1 rent -200
2 food -20
3 gas -10
2 food -10
Sum expenses -240
On account 260

I then use this formula to discern them:
{=ABS(SUM(IF(A$4:A$30=X;C$4:C$30;0)))}............

View 3 Replies View Related

Logic Formula To Calculate Distance

Jul 7, 2009

I have a excel sheet with city names in Column A, Distances in Column B, and Distances in Column C.

I wanted to write a formula so excel checks the distance between column C and column B and if there is less than a 10% difference between the two then it would copy the name of that city into another column D.

View 4 Replies View Related

Logic For Comparing Columns In Excel

Jul 24, 2013

I have data in two cells.If both are different then it should display that column data with different color.

EX:

COL A COLB
1 1
2 1

If col b is not match with col A then it should display that col B value cell with some color.

View 1 Replies View Related

Numerical Logic Colliding With Text

Oct 13, 2008

I have a monster of a sheet going and am working for research purposes. I dislike the interface of SPSS so I use excel to boil down my variables to a smaller state, to which it then goes back to SPSS for the hardcore analysis. Unfortunately, this study has values of "N/A", "Missing", and "." (not entered), so it makes it a bit tricky for me. Say I want to check 10 different scales to see if any are true: =IF(OR(FJ6>=1,ZD6>=1,....etc),"Yes","No"))

Problem is the blasted program is reading ".", "Missing", and "N/A" as greater than one!!!!! I've found a way around by making monster formulas that first check that the field is not equal to those three text values, but there must be a faster way! To see what I mean, put a period in one cell (like A1) and write =IF(A1>=1,"Yes","No") and you'll see it returns a Yes.

View 4 Replies View Related

Large Function - Logic To Handle A Tie

Apr 5, 2012

I use a large function when ranking numbers in an array each month. I'm only interested in the top 5 numbers. However, there are occasions when the top 5 numbers contain a tie. How do you build into a large function, logic to handle a tie. Here's my function, which is very simple:

Code:

=LARGE(C$6:C$40,1)
=LARGE(C$6:C$40,2)
ETC.

View 1 Replies View Related

IF Logic Function - Greater Than Or Less Than With 3 Results

Aug 2, 2013

I'm trying to have three different possible results from one formula based on one cell.

If A1 is greater than 10 I want B1 show 5, AND if A1 is less than -10 I want B1 to show -5, AND if A1 is between 9 and -9 I want B1 to show the value of A1/2.

I've never used logic functions in excel before.

View 2 Replies View Related

Fuzzy Logic Matching Macro

Dec 3, 2007

I've done something similar using functions but I think a macro is best, in essence in calculating in finance world, a Earnings Before Interest and Tax or commonly referred to as EBIT, one often takes out non operating income and non operating expenses.

What I was hoping to do is have a macro

1. Ask the user to shade or highlight which range to calculate from firstly (like Colo's HTML marker with the pointer where you use the border type lines to highlight the boundary first).

2. The macro than inserts a column to the right of the year block highlighted. the macro uses this column to tag the financial line items, ie. in this case below a 1 for income types (can be any tag) and a 2 for expense line items.

3. It than looks through the database of words (and this is where the fuzzy logic comes into it, there are words which would definitely require a tag, but there are others which may require two matching words). I intend to fill this macro with many expressions which auditors and who ever prepare financial reports use as words in their financial statements..

4. So the macro than looks through this database of words for income and also for expenses, and when it finds matches, it tags alongside the finanicial a 1 for income and 2 for expenses .... signifying non operating income or expense.....

View 9 Replies View Related

Number Comparison And Logic Statement

Feb 8, 2007

I'm having a problem with coming up with a suitable excel formula. I have a table that calculates 2 values. Once these values are derived I need them to be compared to a separate table. This is how it works.

Table 1:
Cell B8 gives me total weight: 3187pounds
Cell C9 gives me the center of gravity in inches: 142.02

on sheet2
Table 2: Cell A2-A26 have weight increments every 50 pounds starting at 2200.
Cell B2-B26 have the minimum C.G. limit
Cell C2-C26 have the maximum C.G. limit


My question is how can I write a formula that takes the weight from B8 and compares it to the cells on sheet two (rowA) and finds the closest weight. Then from there finds out if my C.G. from C9 is within limits of my min and max values?
Sounds complex but it's not that bad. I'll upload the file to my website and let people download if they'd like to see it.

View 8 Replies View Related

If Found Function/logic To Paste

Apr 12, 2007

I am creating a macro that will be copying values from one worksheet and pasting them in one of two possible locations into another worksheet - depending on a title for my data. The title I will search on is located in worksheet "Sheet1". If I find the title "WESTERN PERSPECTIVE" in Sheet1, I want to copy a range of values into one place on the other worksheet "Sheet2", otherwise if I find the title "EASTERN PERSPECTIVE" I want to copy a range of values into the 2nd place on my other worksheet "Sheet2".

My logic should follow:
If found "WESTERN PERSPECTIVE" in Sheet1, paste values into area 1 of Sheet2, else do nothing.
If found "EASTERN PERSPECTIVE" in Sheet1, paste values into area 2 of Sheet2, else do nothing.

I do not require coding for the copying and pasting, just the IF logic based on Found fields. I do have the coding which selects the field if the 'Find' is successful:

Cells.Find(What:="WESTERN PERSPECTIVE", After:=ActiveCell, LookIn:=xlFormulas _
, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate

View 3 Replies View Related

IF Statement Logic In Columns - True / False

Mar 31, 2014

Column A: T/F
Column B: True/False

Here's what I want in a sentence: If one of the cells in grouped row is "T", column B = True, if not then column B = False.
(row groups are separated by a blank row)

Example)
Col A,Col B
TTRUE
FTRUE

[Code] ....

I came up with following formula:

=IF(MATCH(TRUE,INDEX(ISBLANK(A1:A17),0),0)>MATCH("T",A1:A17,0),TRUE,"")

It checks to see if blank cell is found before "T" but it doesn't look rows above.

inincubus.grouprows-1.xlsx

View 3 Replies View Related

Nested Logic To Get 6 Outputs From 3x2 Matrix Of Inputs

Feb 12, 2009

I'm having a mental block with what should be some reasonably simple nested logic. Basically I've got 3 possible inputs in one field and 2 in another, and want to get 6 possible results out the other end. The sheet attached shows what i'm putting in (columns A and B) and what i'd like to get out the other end (C). The formula i need in column C is a bunch of AND's that i somehow keep getting wrong

View 5 Replies View Related

Coloring Entire Rows Based On Certain Logic

Aug 1, 2014

Here is my attachment with data in first sheet and expected output in second sheet. Have given comments in second sheet for better understanding.

Data is of a debt collection, in sheet column F "form #" denotes loan form numbers and column L "paid" denotes the amount received or not received.

In this Form # are unique and form number will repeat with different paid amount.

Entire row to be colored based on the sum value of paid column amount of respective form number.

1. non repeated single form number with negative value of paid - Orange color

2. repeated form numbers with sum of values in paid column as positive value - only entire row of form number with negative value in blue color

3. repeated form numbers with sum of values in paid column as negative value - first form number row to be colored with yellow and rest of repeated form numbers with purple color and its sum value (negative value should be made available in yellow line of the Form # group to the right of right most column data)

4. form numbers and paid column of value "0" - pink color

I tried recording and edited macro only for the logic of paid value "0" and confused with other logics and declaring variables...

View 9 Replies View Related

Deleting Rows Of Data The With Use Of Boolean Logic

Feb 6, 2009

I've got a worksheet with five columns of data. The headings run from a1:e1

The number of rows can be anything up to 200,000 rows (I'm using Excel 2007).....

View 6 Replies View Related

Logic Behind The Application.FileSearch Sort Method

Jul 6, 2009

I am writing a class to be used in Excel 2007 that will mimic the action of the FileSearch in 2003, but I am stuck with the sort.

View 2 Replies View Related







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