# Sum Cells Which Meet Certain Values In Non-contiguous Columns

Jan 1, 2009

I'm trying to sum cells which meet certain values in non-contiguous columns. It's difficult to explain so I've attached a sample wookbook.

## How To Count Contiguous Cells If Data Equals Values

Aug 13, 2014

I have some data like the following:

2 3 4 8 4 1 3 3 1 8 1 3 5 8 1 2 5 6 1 7 9 3 3

I would like to be able to count the number of times 1 follows 8 for example. For the data above the answer is 2.

## SumIf Two Columns Meet Criteria

Nov 22, 2009

On the attached example i would like a formula in F2 which sums all the values where column equals "Smith" and column B equals "Golf European". I'm assuming it would involve the SumIf formula but i'm not sure if this is the best solution when the criteria is in two columns?

## Count Row If 5 Columns Within Row Meet Certain Criteria?

May 30, 2014

Basically, need to count rows that have 5 columns of data in it. If all 5 columns within a row have something in them greater than one character, that row needs to be counted.

## Formula For Counting Row Once When Two Columns Meet Criteria?

May 17, 2014

BP Formula.xlsxI'm not sure what formula to use or if Excel can do this. I want to use it to determine number of blood pressures in a certain range. So if I use column A for SBP (systolic BP) and column B for DBP (diastolic BP). I want a formula to tell me if column A is between 140-159 or column B is between 90-99. I can get that part, but what I'm having trouble with is it counting each row twice if both column A and B meet the criteria, whereas I want every row (person) to only be counted once if either column A OR column B meet the criteria. (See attachment)

## Pull All Rows And Columns That Meet Criteria?

Dec 22, 2013

I would like to pull all rows and columns from a table and copy them to a separate sheet. I would like to pull the data if a certain value is present in a particular column. Essentially, it is the same effect of filtering the data but I don't want to have to keep filtering and copying specific cells and pasting them into a different sheet if I need to change the raw data.

Example: I would like to copy all ids, store, and partner information IF the partner is "X". I would like to put this information in Sheet A.

Capture.PNG

## Macro: If Two Columns Meet Condtion Then Highlight Row

Apr 5, 2008

If two parrallel cells in column D & G equal "0" then highlight that row with ======== (Thin Horizontal stripe)

Example:

D2 and G2 both = "0" ( Macro Applies. Row 2 is highlighted with Thin Horizontal Stripe).

D2 and G3 both = "0" (Macro does not apply since they are in different rows)

D2= 1 G2=0 (Macro does not apply since they both dont meet condition.)

## Copy Non-Contiguous Columns

Sep 5, 2007

how to reference an entire column only knowing the column numbers, not letters. The response below was given.

Range(Cells(1, 40), Cells(1, 44)).EntireColumn.Select

I have a similar situation, except that I use the FIND command to return a column number based on a string match.

X_Column = Sheets ("Sheet1").Range("A1:IV1").Find("X").Column
Y_Column = Sheets ("Sheet1").Range("A1:IV1").Find("Y").Column
Z_Column = Sheets ("Sheet1").Range("A1:IV1").Find("Z").Column

Because of this, I can recieve non-sequential column numbers, simply based on where "X", "Y" or "Z" are in the sheet, which can be anywhere. I would like to select X_Column, Y_Column, and Z_Column and copy/paste to another sheet, hopefully without having to loop. I have a feeling that an answer refering to Named Ranges is coming, but I'm very green on the subject.

## Sum Values That Meet Certain Criteria

Mar 25, 2009

I have a spreadsheet that is set out to look similar to a MS Project plan, with dates across the top, users in column A and Assignments in column B. In the corresponding cell that matches the user, date and assignment they will enter the number of hours they anticipate working on the assignment.

I then have a summary sheet that covers all assignments, week ending dates and users. I want to be able to calculate the hours and copy it into the cell in the summary sheet that matches the Day, User and Assignment. I have tried using SUMIF, but this requires the criteria cells to all be in columns, but with this sheet the dates are in a row.

## Delete Rows Where 2 Columns Meet Multiple Criteria

Aug 30, 2007

I have a file with many intercompany transactions. There is a range of business unit numbers that if anyone one number is in both Column B "Bus Unit" and Column E "Affiliate" I want the row deleted.

Please see the attached, it is more clear I hope. The two yellow rows would be deleted.
The list of business units that I would want to never be on the same row is "4, 7, 41, 44, 46, 51"

## Delete Rows Where Multiple Columns Meet Criteria

Apr 4, 2008

I am looking for an Excel VBA code that can delete pair of rows that has certain criteria. I have included an example in the attachment and highlighted the rows that should be deleted. Since the values in each coloumn is going to change every day , I am looking for a dynamic code.

The objective is to:

To delete rows that has same code (columnd D), same basis (coloumn E), same Effective (coloumn H), value of TT (Column J) is either TI or TO and has offsetting Amounts (L) ie the sume becomes zero. Example pair of row 7 and row 8 as well as pair of row 12 and row 13 should be deleted.

TO and TI are actually transfer in and transfer out. Since the TI and TO for these rows make the amount zero for same code and same basis on the same effective date, I do not want to include this in the spreadsheet.

## Number Of Columns In Non-Contiguous Range

Jun 9, 2008

Consider the following range (in my case a PivotTable):A1:E7

I create a Named Ranges that corresponds to column 1:3 and 6 from the range above. i.e : A1:C7,E1:E7

I need to find out the number of columns of my range, this is because it can change in the future, and I have an offset formula needing this information.

When i type =columns(MyNameRange) it returns #REF! as there are 2 areas in my Named Ranges. I am expecting 4.

I have written the a VBA User Defined Function that does the job, but I would like to know if there is no native solution to get this information.

Function TotColumns(rng As Range)
Dim Cols As Integer
For Each Ar In rng.Areas
Cols = Cols + Ar.Columns.Count
Next
TotColumns = Cols
End Function

## Counting Number Of Rows Where Datediff Of Two Columns Meet Criteria

Aug 21, 2013

I have a range of data and need to summarize some of the data. In the table below is an example of the data. I would like to have a single formula where I can count the number of rows where the end date - start date is < 14 days. I would prefer not to add an additional column for the datediff value. Is there a way to do this with either arrays or named ranges?

Name
Start
End
Other data
Verizon
1/10/2010
1/25/2010
AT&T
3/2/2010
4/14/2010

## How To Return All Corresponding Values That Meet 2 Criteria In Excel

Feb 14, 2014

I have a table that I would like to search to return all the values that meet 2 criteria entered by the user.

I have 3 columns - Role Name, Skill, and Skill Level - I'd like to be able to enter the skill and skill level and return all the roles that meet the two entered criteria.

At the moment I have an array, but it only returns the first value from the Role Name column that it finds.

=INDEX(A2:A100,MATCH(1,IF(C2:C100=G4,IF(E2:E100=H4,1))),0)

Where the A column is the role name, C is the Skill, and E is the Skill level. In cell G4 the user enters the skill to be search, and in H4 the level required for the skill (a scale of 1-4)

Is it possible for the formula to return all the values in column A that meet the criteria entered in G4 and H4?

## Calculating On Values On Calender That Meet A Given Criteria

Nov 13, 2009

I find this difficult to explain, so have attached an example. I need to total all entries on a calender that are entered after a specific date. EG:

If the given date is 15 Sept 08, I need all values in Sept - Mar to be totalled. I am measuring data on numerous spreadsheets, all others have specific start dates and finish dates, so its a simple a1-b1 to get the number of days, multiplied by costs. This particular spreadsheet is laid out in calender format, hence the problem)

## Scripting Dictionary - Compare Columns And Extract Data That Meet Criteria

Mar 23, 2014

I have a spreadsheet with 2 tabs:

AllData:
Name
Data

[Code]....

## Match Value To A Non-Contiguous List Of Values

Jan 18, 2010

I have a list of values and value ranges (11 total) that I'm trying to match to values in Column A, but my formula has too many nested "IF" functions to work. My formula is fairly simple, so I'm hoping it will do a better job of describing my problem than I.

=IF(4>A2>0,"1",if(37>A2>24,"2",if(A2=39,"3",if(45>A2>41,"4",if(A2=48,"5",if(A2=62,"6",if(73>A2>64,"7 ",if(A2=75,"8",if(A2=80,"9",if(107>A2>102,"10",if(A2=141,"11",""))))))))))))

There should be a positive result if the cell value matches any one of the following:

1-3
25-36
39
42-44
48
62
65-72
75
80
103-106
141

In the formula I have numbered the results from 1 to 11, strictly for illustrative purposes. A return of X, 1, YES, etc.

## Pass Values Between Two Non Contiguous Ranges

Nov 20, 2008

I have Workbooks("A") and Workbooks("B") open.

Workbooks("A") contains Sheets("Sheet1"). Range("mySource").
Workbooks("B") contains Sheets("Sheet1").Range("myTarget").

Both ranges have been created by joining multiple ranges, in this way:

Union(Range("C1:C13"), Range("K1:K2"), Range("K5:K9"), Range("K14"), Range("Q6"), _
Range("I18"), Range("B20:P20"), Range("B24"), Range("C26:E26"), Range("C29"), _
Range("B34:B40"), Range("B44:Q50")).Name = "mySource" 'or "myTarget"

So: both ranges contain the same number of cells with the same addresses, and they have been added in the same order. However, if now I try to pass all values from mySource to myTarget, in this way:

Workbooks("B").Sheets("Sheet1").Range("myTarget").Value = _
Workbooks("A").Sheets("Sheet1").Range("mySource").Value

the result is a complete mess. Only the first "subrange" of mySource ("C1:C13") is passed to myTarget, and pasted in each of its "subranges", sometimes by rows and sometimes by columns...

## Replace Different Values Within Non-Contiguous Ranges

May 8, 2008

I had some code working fine in office 2003:

Sub Replacing()
Dim rRange As Range
Dim lArea As Long
Dim Co As Byte
Dim NaCo As Byte
NaCo = 99
Set rRange = Range("B:C,E:F,H:I")
With rRange
For lArea = 1 To .Areas.Count
With .Areas(lArea)
Co = Choose(lArea, 1, 2, 3)
.Replace What:=Co, Replacement:=NaCo, LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End With
Next lArea
End With
End Sub

the problem is that it's not working for Office 2000

## Replace Same Value Within Non-Contiguous Ranges With Different Values

May 18, 2008

This time I want to replace:
number "99" in range("B:C") to number "1";
number "99" in range("E:F") to number "2";
number "99" in range("H:I") to number "3";

Sub Replacing()
Dim rRange As Range
Dim lArea As Long
Dim Co As Byte
Dim NaCo As Byte
NaCo = 99
Set rRange = Range("B:C,E:F,H:I")
With rRange
For lArea = 1 To .Areas.Count
With .Areas(lArea)
Co = Choose(lArea, 1, 2, 3)
.Replace What:=Co, Replacement:=NaCo, LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End With
Next lArea
End With
End Sub

## Grouping Contiguous List Into Non-Contiguous Groups

Sep 9, 2006

I would like to be able to count the amount of entries in column C and depending on the amount group them in either groups of 3 or 4, all names would be unique...so if there are 14 names in the list they would need to be grouped in to two groups of 4 and two groups of 3, if there were 19 then 4 groups of 4 and 1 group of 3 etc to a maximum 50 people, the results could appearon a seperate worksheet say pasted on to the worksheet starting with the groups of 3 (so paste a group of 3 then skip 3 rows then paste groups of 4 skip 2 rows, the row skipping is to allow seperation and manual entry of extra data). There will never be groups of 5 or more and never less than 3

## Load Array With Values From Non-contiguous Ranges

Aug 2, 2014

I have tried:

Code:
With Sheet1
x = .[b7:i16,b19:i23,b27:i32].Value
But that only loads the first range (.[b7:i16]).

This does work:

Code:
.[b7:i16,b19:i23,b27:i32].Copy .[z1]: x = .[z1:ag21]: .[z1:ag21].Clear

I would rather avoid having to copy/paste, load the array, then clear. Is there a way to load the array directly?

## Paste Non Contiguous Range As Values To Last Used Cell In Row

Feb 14, 2008

I am trying to copy paste info from one sheet to another, however, I would like to select where the information is to be pasted, not have it go to a predetermined cell or column.

Here is the code I have so far that works fine, but it requires a macro for each column I would like to paste to.....

## Look For Cells That Meet 2 Criteria

Oct 6, 2006

I have built the following code which should look through a data sheet and then work out the instances where it meets the following criterias:

= "Client A"
= "First letter of surname is "a"

The code is as follows:

Public rowcn
Sub compare()
Dim rngTemp As Range
Dim intCounter As Integer
loop_col = "Client A"
data_sheet = "Data"
target_sheet = "Summary"
rowcn = 2
Do.............................

## Regression Error - Non-Numeric Data / Contiguous And Complete Rows Or Columns

Apr 10, 2013

However I have a subject at uni that requires me to create a series of regression models, histograms, correlation matrices etc.

For part of the assignment, i have to run 4 regressions (one for men & one for women) with dependent variable as average wages, and independent as bfast 1,2,3 and dinner 1,2,3 (all of which are dummy variables) (0 for male and 1 for female).

The second two regressions are exactly the same, except average wages must be transformed into log which i have already done.

I dont know how to differentiate the regression models into male and female (if possible). We must also include residuals and residual plots.

I keep getting an error that says non-numeric data, the other says input range must be a contiguous reference.

## Copy And Paste Special Values For Non Contiguous Ranges?

Mar 18, 2014

I use to have a macro that could copy formulas from non contiguous ranges and paste the values in the same cells. So for example, I could select a non contiguous range like B5:B10, E10:F12, and G1:G10. The macro would then copy and paste the values in those 3 ranges, so those 3 ranges would be values instead of formulas.

I think it worked by storing each range and then looping through each range to copy and paste special values.

## Formula To Return True/False If A Row Has 6 Contiguous 0 Values

Sep 25, 2009

I have number data in columns F through AK. In column AL I want a formula that will look in columns F through AK from the left to right. Once it identifies a positive value I want the formula to identify if after that positive number there are any occurances where there are 6 0's in a row (anywhere up until column AK). The formula can return a True or False. I want to drag the formula down across many rows of data. If the entire row contains 0's, I do not want it identified as a TRUE

## Highlighting If A Range Of Cells Meet A Value

Jan 19, 2008

I have a worksheet 200+ rows with 7 columns (euro lottery numbers) I had great help last night to highlight any matching numbers. I'm getting lazy now, can anyone help with a formula to highlight a cell in an adjacent column when 2 or more numbers in the corresponding cells match the winning numbers, I know all I have to do is look down the columns and check but if a simple formula could be inserted it would save me perhaps missing something.

## Listing Cells That Meet A Criteria

Apr 11, 2008

I have a list of items (TR Sets) from 1 to 96 in the range B4:B99, with values corresponding to each one (Acid Number) in the range C4:C99. I would like to make a separate list that names each TR Set (using numbers 1-96) that has an Acid Number > 0.1 . Is there a formula to do this?

## IF Statement - Two Cells To Meet One Criteria

Jun 18, 2013

I need a formula that will tell me if EITHER two cells = a text word. I've tried a few things and can't seem to get it to work!!!!

See in the example of my spreadsheet below: If A2 = FALSE or B2 = FALSE then D2 should display "Allowed" if either are TRUE D2 should display "Not Allowed"

Is this possible!?!?! I've tried way to many different formulas and am close to giving up..

A
B
C
D

1
Not Slow
50%
FY
Change

[Code] ........