Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Excel


Finding The Maximum Value In A Column Based On A Condition

This should be simple to do but I can't figure it out. I have a database that lists operating room numbers in one column and the length of the surgeries performed in those rooms in another column.

I need a formula that will give me the longest OR time for a given room. For example the room numbers are in column A and the OR times are in Column B. I've tried something like

View Complete Thread with Replies

Sponsored Links:

Related Forum Messages:
Maximum Based On Condition
function that can find the maximum value in a range, where the range is defined by the rows containing a specific string, i.e:

In column A:
Alm Rød
Alm Grøn
Alm Blå
Special Rød
Special Grøn
Special Sort

In Column B I have values for each of the above string names.

Now I would like to find the maximum value for the range with names starting with "Alm".

View Replies!   View Related
Finding The Minimum Value In A Column That Comes After The Maximum Value
Say I have 2 columns that in basic form look like this:

Column A Column B
Jan 1
Feb 0
Mar 7
Apr 4
May 15
Jun 2
Jul 5
Aug 4

First I want to look up the max value in this column. This is easy =max(b1:b8)
Then I want to know the minimum value that occurs after the maximum value. Thus the answer would be 2.

View Replies!   View Related
Calculate The Average Of A Group Cells In One Column Based On The Condition Of Another Column
I'm trying to figure out if there is a formula I could use that will calculate the average of a group cells in one column based on the condition of another column. It's hard to explain, so I will show an example. All the data is on a one worksheet and I'm trying to show totals and averages on another worksheet. Location, Days

17, 4
17, 3
17, 5
26, 4
26, 8
26, 10
26, 7

On a different worksheet I would want to know what the average days are for each location. So is there a formula that I could use that will look at column A for a specified location number and then average all the days in column B for that location? I'm using Excel 2003 and have tried using the Average(if) but with no success.

View Replies!   View Related
SUM MAXIMUM Or Index/Max: Count Number Based On The Maximum Time??
I was hoping that my formula would give me the count number based on the Maximum time (latest time) and the Name field...My result is a 0 instead of 62 (the correct answer).

=SUM((Download!$H$2:$H$10=A4)*(Download!$D$2:$D$10=MAX(IF(Download!$H$2:$H$10=$A4,Download!$D$2:$D$1 0)))*Download!$I$2:$I$10)

Would a Index/Match/MAX function be more efficient?

View Replies!   View Related
Condition Paste Formula In Column N Based On Column A
I am wanting to paste formula from N1 till N X (X = varaiable row) where X reliant on Column A Row X. If Column A Row X has character "=====" it should paste N1 Formula all the way down till N Row X which is equal to A Row X containing "=====" .

I might be sounding complicated over here but it is a simple equation.. I have tried to approach this in the capacity i could by condition if Column A row x is blank delete the row.

View Replies!   View Related
Finding A Cell Based On Column
I'm looping through and finding a cell based on Column A, and I .resize(,5).select and from that selection I want to create a range called "LCrng"

View Replies!   View Related
A Macro To Finding Maximum Value
i have a table same this in 5000 rows and 10 columns that are years from 1998 to 2007. ISO2 is two digit names of countries.

ISO2 D1998 D1999 D2000 D2001 D2002 D2003 D2004 D2005 D2006 D2007
CL 135 147 180 192 48 629 494 137 135 359
CL 132 145 177 190 45 623 491 134 132 356
CL 129 141 174 186 42 617 488 131 129 353
EC 126 139 171 184 39 611 485 128 126 350
EC 123 135 168 180 36 605 482 125 123 347
EC 120 133 165 178 33 599 479 122 120 344
KH 117 129 162 174 30 593 476 119 117 341
KH 114 127 159 172 27 587 473 116 114 338
KH 111 123 156 168 24 581 470 113 111 335
PH 108 121 153 166 21 575 467 110 108 332
PH 105 117 150 162 18 569 464 107 105 329
PH 102 115 147 160 15 563 461 104 102 326
PH 99 111 144 156 12 557 458 101 99 323
VE 96 109 141 154 9 551 455 98 96 320

i want a macro to advance filter column A and make a unique list of it and then find the maximum value of each country in column A in 10 years. for example final table for country "CL" must be same this

ISO2 D1998 D1999 D2000 D2001 D2002 D2003 D2004 D2005 D2006 D2007
CL 135 147 180 192 629 629 494 137 135 359

View Replies!   View Related
Finding Equivalent Of Maximum Value In Another Sheet
I have to sets of data, each in a sheet with the first column as identical for both sheets. Sheet2 contains two series of 6 rows, each for a specific first column (""B Code").

Now I want to find the values of "TCT-C" column in sheet1 (for each range of 6 rows that the "B Code" is match) which corresponds to the row number that "TCT" in sheet2 is maximum (again for 6 rows). The point is, I need to shift to another series of 6 rows in sheet2 once the "B Code" does not match.

View Replies!   View Related
Finding The Maximum Value Of All Those Meeting A Certain Criteria
Range A2:C10 contains the login and logout times of various ID's.
Each ID could log in and out a number of times a day.
How could we find the first time a specific ID logged in and the last time that same ID logged out?

For each of the ID's in range A2:A10, enter two Array Formulas.
To find the first login time (Column B) enter the following formula:
To find the last logout time (Column C) enter the following formula:

ID______Login Time______Logout Time
1 ______02:40___________03:10
2 ______00:15___________03:20
1 ______06:20___________09:30
3 ______09:14___________11:05
4 ______11:00___________19:30
2 ______04:05___________06:55
3 ______12:08___________17:17
1 ______10:00___________16:20
2 ______08:12___________12:33

ID______First Login Time______Last Logout Time
1 ______2:40__________________16:20
2 ______0:15__________________12:33
3 ______9:14__________________17:17
4 ______11:00_________________19:30

View Replies!   View Related
Finding Maximum Number For A Range
selecting a range under a condition. I'd like to write a macro to find the maximum value for a certain ID. The number of ID rows (left column) is unknown so can't say range("A1:A5"). Then have the ID and max number shifted to another column. Maybe use 'rows.count' ?


4009 5
4009 9
4009 8
4009 4
4005 7
4005 3
4005 9
3008 10
3008 11

View Replies!   View Related
Finding Maximum Value While Excluding Some Values
I have a row of data with the cells I want to find a MAX for are separated from each other:

a1=300 d1=500 g1=800 j1=10,000

I want to find the MAX value for a1,d1,g1,j1, but exclude any value over 1000. So instead of =MAX(a1,d1,g1,j1) returning 10,000, =???(???) will return the next highest max of 800.

View Replies!   View Related
Finding The Cell Address Of Maximum Value
I have a range of overtime data. I want to list the maximum occurrence of first 10 overtime data ( Like 3200,2950.2300....etc) Thereafter from the results obtained I need to know the cell address of the employee corresponding to the results obtained, i.e XYZ, ABC.....

Employee Name OT Amount
1. XYZ 3200.00
23. ABC 2950.00
35. WER 2300.00

View Replies!   View Related
Finding 2nd Maximum In An Array
Very simple problem. I need the second highest value in an array. Max gives me highest. Min gives me lowest. I need a kind of a MAX2 function.

View Replies!   View Related
Selecting Rows Based On A Column Condition
I have a worksheet which is created monthly by one of our company's employees which reports results for that months operations and successful audits. These audits are separated into various service lines and on the report which is submitted it takes on the following format:

1|Service Line|Data A|Data B|Etc.
2|___CR_______| Data | Data | Etc.
3|____________| Data | Data | Etc.
4|____________| Data | Data | Etc.
5|____________| Data | Data | Etc.
6|___DD_______| Data | Data | Etc.
7|____________| Data | Data | Etc.
8|___MS_______| Data | Data | Etc.
9|____________| Data | Data | Etc.

What I want to do is use a macro from another sheet that has the effect of: While ServiceLine = "CR" copy the row of that line and move it to my monthly summary workbook, sheet 1. Then when the Service line changes to DD have the macro copy that information to the monthly summary workbook sheet 2, and so on. The problem is, if I test the Service Line column each time it will be an empty string the majority of the time and I'm not sure how to combat that with my If, Do, For, and While statements. As I've thought about it there are two solutions that I can think of: someone knows of a way to test the row only if it has information in it, or if there is a way that I can copy the service line information down until the change in service line so I can test Service Line on each Row.

View Replies!   View Related
Delete Rows Based On Condition Of 1 Column
I would like to Use my Excel VBA program to search each row in a csv document for a name (located in a cell ) if the name exists then I would like to delete the entire row.

Whenever I try to do the above in excel, even when I save in csv format the file formating or something gets changed and the file which has to be procesed through another program then process incorectly.

Is there a way to do what I need while retaining the formating which must obviously be changed when the file is opened in excel?

View Replies!   View Related
Match Column And Colour Based On Condition
i am trying to do is match 2 columns data based on a condition ie i have data in column "b" of sheet called "balance" data is variable this column has unique indentifiers i want to look at another column and match the uniques identifiers in another sheet if the cell value in column "D" = "please investigate" otherwise do nothing, the (column f) it will be looking up too is in sheet called "hi- port" so if cell value in column "d" of sheet"balace"= "please investigate" match values that are same from colum "b" of sheet "balance" to that of column (f) sheet called "hi-port"

i would like to colour only entire row of sheet called "hi-port" when the data matches to other sheet ie from columns "f " too " b". colour can be any colour
igonre my ranges they are wrong just used as example

Sub start()
Dim oWs As Worksheet
Dim oRngCheck As Range
Dim oCl As Range
Dim cCola As Range
Dim cColb As Range
Dim rngIRd As Range
Dim rngACs As Range
Dim Match As Boolean
Set rngIRd = Range("a1", Range("a65536").End(xlUp)) 'define the rang
Set rngACs = Range("b1", Range("a65536").End(xlUp)) 'define the rang
Set oWs = Worksheets("balance") 'change to suit
'starts at b2 to llow for header row.......................

View Replies!   View Related
Exclude Rows Based On Condition In 1 Column
I have a worksheet that I want to export to a csv file. However, there are multiple rows that I want excluded in the export. These lines are recognized by the word "No" in column E. Is this possible?

View Replies!   View Related
Sum Values In Column Based On Condition In Another
II want to sum the values under 'amount' column only if the corresponding value under 'Balance' column is "Paid"

NameAmount Start Date End Date No.of DaysInteresetBalance
Sat1 250 1-Aug-07 20-Aug-07 19 - "paid"
Sat2 550 4-Aug-07 20-Aug-07 16 -
Sat3 250 10-Aug-07 20-Aug-07 10 - "paid"
Sat4 450 6-Aug-07 20-Aug-07 14 -


For the above, the sum value should be 500. I have written the following function to calculate the same. On uncommenting the line 'paid = CStr(paidvar)' the value is displayed as '#VALUE!'. On uncommenting all commented lines, the value is displayed as 'Paid'.

Function PAIDAMOUNT(amountRange As Range) As Variant
Dim count As Long
Dim paidvar As Variant
Dim paid As String
Application.Volatile True
For count = 1 To amountRange.Cells.count
paidvar = amountRange.Offset(count - 1, 7 - amountRange.Column).Value
'paid = CStr(paidvar).................

View Replies!   View Related
Finding Data Based On Row & Column Criteria
I have a main soure data which consist of row & column information. What i want to do is search the data from the source data into my result data as per the attachment file. Example: I want to information of Jan & banana from the main source file to appear in the XXXX

Result data(criteria base on Month & type)

View Replies!   View Related
Copy Multiple Cells Based On Condition In Column
I need the macro that looks in to say Column H sheet1, if value ="true" then copy cells in column A, B, D, F to Sheet2.

View Replies!   View Related
Finding The Maximum Number Before A List Turns Negative
i have the volume of a reservoir in column A for lets say, 2 years, with monthly data (so 24 numbers in my list)

I also have some variables that feed into this list such as rainfall (fixed), and population (i.e water use, which i can manually change)

if i increase the population too much, the volume of the reservoir will at certain times of the year, fall into negative digits.

what i'm looking for, is a cell which works out the maximum value (in whole numbers) for my population, without any of the numbers in the reservoir volume list falling below zero.

View Replies!   View Related
Finding The Maximum Occurrence Of Text Over Non-consecutive Cells
I’m trying to figure out how to show the highest occurrence of text in 10 cells which are not next to each other. Some of the cells will also be blank And the other thing is if there is a draw e.g. 5 2Z and 5 1Z I'd like it to show that, either with a word e.g. "DRAW" or anything really other than just putting whichever of the 2 "notes" in it feels like

Attached is a spreadsheet (all other data deleted) that shows what I am wanting to do – I have typed the results I am after directly in to the cells in columns BE & BF – BE will need some kind of countif, but when I try that is says I have too many arguments! I have to leave the columns in between blank in this case as they have other info in them, which is really annoying as if those 10 cells were contiguous then the formula

View Replies!   View Related
Finding Duplicates With Condition
way to wrap or format anything in this post. I dont think the text I put here is code, but I want to be sure, after receiving a moderators infraction for failing to properly wrap code in a previous post.


I have a wks in which the first column is a list account #'s and the folowing columns are specifics of transactions or interactions.

Lets say it is a movie rental customer list that lists each rental, and column "A" is the customer number, column "B" declares if it was returned late.

I need to compile a list of "all" rentals by customers who have "EVER" had a "late return" or a "YES" in column "B".

I need to find all account records/rows of accounts that at any time had a "YES" in column "B" even if the some or many of that customers rentals/entries have "NO" in column "B"

so say: ...

View Replies!   View Related
Finding Duplicate Records With Condition
Wondering if there is a way, script-wise or formula-wise that will look through a table and find duplicates but not just any duplicates, it has to match a certain criteria.

For example, I have a column for UPC and Vendor#. I have my table sorted by vendor (all 159 of them in one table) I want to find out whether a UPC appears more than once for a vendor.

UPC --- Vendor
11254 135
11251 135
11251 135
11254 9345
11251 9345

Here, as you can see, UPC 11251 appeared more than once for vendor 135. Can this be done through conditional formatting ? or a script?

View Replies!   View Related
Finding The Minimum Time And Maximum Time
NameTime InTime OutAlan08300930Alan10001030Alan12301630Tony11301230Alan09450950Tony10301115

I would like to find the minimum time in and maximum time out for each person. The data type of Time In and Time Out are general.


NameTime InTime OutAlan08301630Tony10301230

Therefore, I would like to know what function in excel will enable me to perform such task. Furthermore, can this function use with VBA?

View Replies!   View Related
Return MAXIMUM Based On Criteria
i have a spreadsheet like the following

Country Revenue Month
1 UK 10 Jan
2 France 20 Jan
3 US 30 Jan
4 UK 25 Feb
5 US 35 Feb
6 France 5 Jan

and so on...

So where country = UK, France or US I want to retrieve the MAX revenue from all months and which month it was in. Eg UK max revenue was in Feb of 25. I am not sure how to apply the max formula with criteria. Is there any way to do this?

View Replies!   View Related
Maximum Value Based On Multiple Variables
Maximum value based on multiple variables. Basically what I have is something like this:

View Replies!   View Related
Give Maximum Value Of A Column
I would like to write a formula to have a result in a cell that gives me the maximum value of a column, but smaller than another cell.

For example:
C1 = Maximum value in column A1:A20, but smaller than B1.

View Replies!   View Related
Add To Maximum In Column
I need a formula for Excel

I want column J2 to L2 to display the highest amount on colum M2 and add 2 to it.

I've tried some IF formula.

View Replies!   View Related
Take Value To Left Of Maximum Value In A Column
Trying to grab the value to the left of the max value in a range of cells. Wasn't sure if I needed to use the offset function, I tried the vlookup function but the value i'm searching for is in the 2nd column, not the first. I can't download files at work, so if you could examine the example spreadsheet i uploaded, and then type the formula I should use in the post.

View Replies!   View Related
Cell Of Maximum Value In Another Column
I have a problem looking up the cell at which a maximum value in a curve is located. I have attached a workbook with an example of my problem (this is scaled down to limit the size of the attachment – my usual string of data is 5000 rows long). Column A is the time and all subsequent columns will contain force values (as shown in columns A and B) which create a similar sharp curve.

Ideally I need to be able to lookup the time point (column A) at which the maximum force value occurs for each curve or if this is not possible the row number in which the maximum force value occurs. I would like to be able to do this using a formula rather than a macro if that is possible?

I have tried using a number of excels lookup functions and read through the examples on the site but have had no success.

View Replies!   View Related
Finding The Sum For Values In One Column That Are Connect To A Value In The First Column
I have two columns. One column has UPCs - some of which are duplicates. The second column just has number values. I'm trying to add the sum of all of the numbers in column two which are attached to their respective UPC. For example,

COL A///// Col B
11111111111///// 10
00000000000///// 15
11111111111///// 10
11111111111///// 4
00000000000///// 2

So, I need a third and fourth column to give me the total value for a single SKU(col A) of all the values in col B. In this example the Third column would contain the SKU, and the fourth column would contain the sum of all values in column B that are associated with the single SKU in column three. The third and fourth column would look like this:

COL C///// COL D
11111111111///// 24
00000000000///// 17

View Replies!   View Related
Maximum Value In A Column In A Pivot Table
I am new to working with Pivot tables, and am working on a data set of survey results. We'd like to build a heat chart into the pivot tables for each column of data. To do this, I need to determine what the maximum and minimum values in each column are, and base the cell coloring on the difference between min and max values by quartile. Ideally, this would be able to update when the column headers change (from a list of departments, to countries for instance).

View Replies!   View Related
Return Heading Of Column With Maximum Value
In attached example, I have 3 columns of fractions with a final row of sumtotals (taken from elsewhere). I test to see which column has the maximum value in each row and allocate the result with the column's heading. Sometimes, two or more columns have the same max value. In this scenario, I wish to select the column heading that has the largest sumtotal.

View Replies!   View Related
Return Corresponding Cell For Maximum In Another Column
* I hav two columns B and N having some data. From column N i need to find the Maximum valued cell.

* And now i need the content of a cell in column B in the same row , which matches with maximum value.

View Replies!   View Related
Maximum And Minimum Formulas Based On Date Range
I have a spreadsheet with two columns - column A contains dates and column B has the corresponding data (always numbers). The data is not uniform (i.e there may be lots of entries in any given day and none over the next few). The data is always sorted in chronological order.

I want to set up a summary table to show the min, mean, median, max for each week. I have set up an array to calculate the mean, but I am having trouble working out a good way of gettting the others short of having a set of columns that manually define each cell...for instance =min(b3:b27) or =min(b28:b30).

View Replies!   View Related
Mark Maximum Value In Range Block Based On 2 Columns
I have a long list of stock values (col C) arranged in time blocks so;


19:00 50.00 0 47.1
19:00 51.00 0 47.5
19:00 52.00 1 48.3
19:00 51.00 0 47.3
19:10 36.00 0 45.3 (nb time has changed)


I need a routine that takes the following action;

When the value 1 occurs in col M row .. (it will only occur once in each time block) and N1 on the same row has the highest value [ 1 and 48.3 above] put 1 in column O on the same row else a 0.

If 1 occurs in column N (time block X) and the value in N is not the highest then store a 0.

This needs to be done for each time block.

It feels like this can probably done by an If or vlookup type of routine but I can't come up with one that works across blocks of times.

View Replies!   View Related
Identify/highlight Maximum Value Based On Multiple Criteria
I have a file with telemetry data for n individuals. For each individual I have data on a number of days, over the course of a couple of years. On any given day, I have from 1 to several "fixes" for an individual. Fixes range from 1 to 3, with 3 being the "best". Note that I do not necessarily have data for all individuals on a given day. What I want to do is extract the row with best fix for each individual, on each day for which I have data for that individual. If there is more than one best fix for an individual on a given day, then I want to choose the first best fix (temporally). Right now my data is set up with columns:

INDV DATE TIME FIX ....other attributes

INDV = unique code identifying the individual

The data is sorted by INDV, then by DATE, then by TIME.

I figured I could do this using nested IF statements, where "TRUE" would be added to a new column (e.g., HIGHFIX) in the row of the first highest fix on each day for each individual, but have not been successful in doing this. I've also tried conditional formatting. Again, no success here.

View Replies!   View Related
Return Values In Range Based Upon Relationship To Maximum Value
I am looking to select two values from a range based upon their relationship to the maximum value. In this specific case I am trying to calculate the Quality factor based upon the frequency response of a transducer. So I need to identify the Maximum impedance and its corresponding frequency. I also need to identify the 3db points either side of the maximum impedance.

The 3db points are found at 2/3rds of the maximum value of the impedance (Impedance Mag in attached spreadsheet). Calculating the first 3db point isn't overly difficult as I just calculate the value for the 3db point and use the MATCH function to find the closest Impedance value and then work out the corresponding frequency from that. I am stumped as to how to calculate the second 3db point (above the Max impedance value). I have attached a spreadsheet with frequency information in column A, the other columns are used to derive the values found in columns M (Impedance Mag) and N.

View Replies!   View Related
Return Column Number Of Maximum Value From A Table
I have a got a table ( 10x30) with random numerical values.

How can I return a column number with maximum value?

Values will be changed periodically so the maximum number could be in different column each time


The results will be 4.

View Replies!   View Related
Find The Maximum Value In One Column And Retreive The Name Of Cell In Corresponding Row
I spent couple of hours trying to figure this out, but without success. Please check the attached example. I need a formula that will find the max value (number of views in English anguage) in the column "I" and display the corresponding "Headline" value in the column "B". In the example it is "Headline 5".

I can not change position of the columns, i.e. "B" must remain "B" and "I" must remain "I".
I experimented with Index and vlookup but to no success. I have outlook 2003.

View Replies!   View Related
Find MAXIMUM, Show Date When MAXIMUM Occurred
Look in Column E and find the MAX value. Once you find the MAX value, (let's say E27) display the date that's in C27. I bet this is really easy but I've been screwing around with it for over a half hour and can't get the correct result.

View Replies!   View Related
Finding Last Column
Using and array to go through a series of sheets and do stuff (Thanks Gerald and Von Pookie BTW). I have used code which finds the last row (varies from sheet to sheet), but not the last column (which also varies sheet to sheet).

Finding Last row
LastRow = Range("A" & Rows.Count).End(xlUp).Row

However this code doesn't seem to work for last column...sample...
LastCol = Range("A" & Columns.Count).End(xlLeft).Column

Is there a trick I'm not seeing? Does this only work using the 'Cell' function in VBA? If so, how would the line of code look? I'd really prefer finding the column letter as opposed to using the 'Cell' method if possible.

View Replies!   View Related
Finding Column Or #
want to look at a row and find out what column has a Y in it

View Replies!   View Related
Finding Column Name
How can i know name of the column.


View Replies!   View Related
Finding Last Used Column
I am currently using the following code to find the last cell in a column that contains data.

lLastRow = ActiveSheet.Cells(Rows.Count, "a").End(xlUp).Row

Can anyone give me the version of this that would find the last cell in a row that contains data. The code would be used in a loop so I would need the row reference to be a variable.

View Replies!   View Related
Finding Cells Based On Two Criterias ....
I want to create a conditional formatting formula, which marks products currently in stock.
Lets say that I have the following setup:

View Replies!   View Related
Finding What Numbers Are In One Column But Not The Other
I have a large list of numbers in two columns. I need to know what numbers are in column A but don't appear in column B. For example if the numbers are 1 2 and 3 in column A but column B only has 1 and 2 I need to know that 3 is missing.

the only thing I can think of is doing =IF(A1=B1,"TRUE","FALSE") however typing this a thousand times would not be practical.

Is there a macro that can check column A against column B and tell me which ones are missing?

View Replies!   View Related
Finding Names In A Third Column
I have three columns of names. I need to loop through the first two checking to see if any name is in the third column and if so, place a 'found' in a fourth column.

View Replies!   View Related
Finding Smallest Value In A Column
In column A, I have a list of names.
In column B, I have a list of values.
I want column C to show me which name has the smallest value from column B.
In other words, if there are 5 names, I want ONE name to give me a value of 10 (for the smallest value), and the rest of the names I want to show zero.

I also have in column D another list of values.
In column E, I want to show first, second and third place amongst the list of values from column D. The rest of the names I want to show zero.

View Replies!   View Related
Copyright © 2005-08, All rights reserved