Finding The Maximum Value In A Column Based On A Condition

Nov 7, 2008

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

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.

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).

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.

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

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.

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.

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.....

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

Problem: 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?

Solution: 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: {=1/MAX((A14=$A$2:$A$10)*($B$2:$B$10 To find the last logout time (Column C) enter the following formula: {=MAX(($A$2:$A$10=A14)*($C$2:$C$10))}

I am now working on an excel spreadsheet which will automatically update every day so that one row will be added on the top of the sheet everyday.i.e.

A1 Date Price A2 (New row added,date) (New row added,price) A3 16/1/2013 5.5 A4 15/1/2013 5.6 A5 14/1/2013 5.45 ... ...

Assuming that I am looking for maximum value of the column "Price", since max() cannot be applied to variable range, is there other method I could useto look for the most updated maximum value of column "price"?

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' ?

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.

I am writing a formula for finding a maximum out of three average values. The cells that will be populated with data are A1 to A5; B1 to B5; C1 to C5. The final cell where I want to write the formula needs to show the maximum of the three averages (average of data in each row).

The difficulty is that sometimes only the A and B rows are populated (and sometime only A row is populated) and if B and/or C are blank, the formula fails and shows "#DIV/0!".

How can I write so that if C is blank, then evaluate only A and B data. And If both B and C are blank, then just display the average of row A.

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

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.

I need a formula to be placed in cell Col A, Row 1, that concatenates any and all cells in Col A, with a ';' separating each item. I only want this concatenation performed ONLY IF an adjacent cell in Col B contains the letter 'X.

Additionally, if the cell in Col A is null, then I the formula to ignore it, and not perform the concatenation.

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 PAIDAMOUNT = 0 For count = 1 To amountRange.Cells.count paidvar = amountRange.Offset(count - 1, 7 - amountRange.Column).Value 'paid = CStr(paidvar).................

i have product group,product name and the statistics. I'll use an example of students with score. I have these set of data:

A B C D 1 Student Name Score Sum 2 Student1 Anna 48 80=Sumif(A:A,A2,C:C) 3 Student1 Anna 32 80 4 Student2 Tom 30 80 5 Student2 Tom 30 80 6 Student2 Tom 20 80 7 Student3 June 55 60 8 Student3 June 1 60 9 Student3 June 4 60

Now we have 2 students with tied highest scores with 80 Scores. Naturally i want the rank to be as follow: Top1 Anna since she has the highest score "48", and Top2 Tom, and Top3 June.

The problem is, the score data can vary and Top3 can probably have the highest score and he still didnt make the highest score collectively. And there will also going to be other situations as well because im working on a very large data set, and not these 3 students.

the max score is tied, and since im making another column with sum scores, the data is going to be redundant, and hopefully theres a formula to ignore this.

I've schedule header date 1-oct,2-oct,3-oct.....etc and have two cells Last Date and Hours I need from those cells once i add date and hours to copy the hours and paste in schedule header in the exact date..

for example # Last date Last Hours

[Code]....

but was too slow takes long time.

2nd VBA code to copy last hours to schedule date based on condition on last date cell.

15.png Attached is the file & snap shot for the problem.

TABLE A [table="width: 500, class: grid"] [tr] [td]Catagories state names devices A4-100HP A ALT

[Code] .....

TABLE B Catagoriesstate names devices A4-100HP A4-101MP A4-102AP

[Code] ....

In above condition we want to have an automatic filling up of data in table B in column (name & device) but it should match first with state name with category codes of table B & then same with table A in order to avoid any wrong entry because in table A certain states are repeated but codes are unique so we want that filter should match two column of each table before filling data in table B.

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.

I have an excel sheet with 2 tabs. 1st tab provides the data for downtime of a manufacturing line. The last column (shift) is blank and needs to be filled based in shift schedule in tab2

On the 2nd tab I have the shift schedule, which tell which shift is working on particular days

Month Date 7:00am- 7:00 pm 7:00pm - 7.00am

Feb 1 Shift A Shift C

[Code] ........

Is it possible to write a macros that will look at the Date and time from tab 1 and assign the correct shift number in the shift column. For example the 1st row of tab 1 reads (Month=Feb, Date = 3:55:59 AM) so according to shift schedule it would fill C shift.

I have lots of data and to assign every event to shift # manually is not possible. So i wanted to know if there is a macros i can use to make life easier and learn at the same time

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?

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.......................

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?

I am attempting to update a column of numeric values based on finding and validating record IDs in two different worksheets. So for example if in worksheet1 in column 'C' the ID is 1234ETC and in worksheet2 1234ETC is found then I want to update worksheet2 in the corresponding cell for that record ID in column 'J' with the information from worksheet 1. So far I have been using a routine like the following to go through and compare the ID's but now I need to update the other cells in column 'J' reveiw the following and see if there is a way to improve upon this.

Sub UpdateCommitmentAmtsFromImport() Application.ScreenUpdating = False Dim bottomC1 As Integer