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 1Aug07 20Aug07 19  "paid"
Sat2 550 4Aug07 20Aug07 16 
Sat3 250 10Aug07 20Aug07 10  "paid"
Sat4 450 6Aug07 20Aug07 14 
Total PAIDAMOUNT(B1:B4)
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).................
View Complete Thread with Replies
Sponsored Links:
Related Forum Messages:
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
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
Sum Values In Column If Condition Met In Another
If possible, I would love for the answer to be a "formula" and not a macro, but if it must be a macro, then that's doable too: Basically, I would love a formula that would add all the numeric values in "Column A", as long as "Column B" in that same row="YES". So... 4 YES 6 YES 7 NO 9 YES would mean 4 + 6 + 9 = 19 This will cover a variable amount of rows, but it will definitely be less than a few hundred.
View Replies!
View Related
Find & Replace Values Based On Condition
I have a simple problem I am trying to find a set a values on a column and what to replace once found with the first 5 most left characters. Example: in column A I can have text and numbers; the numbers that I want to find are in the following format xy:zw / xy:zw on each case the values can be from 0 to 9 so this is tons of posible combinations, I been trying to use **:** ? **:** but I don't get none. This is what I am doing Set target = Sheets("Sheet1"). Range("A1:A9000") For Each cell In target If cell.Value = "**:** ? **:**" Then cell.Value = "00.00" Next cell A example would be 02:47 / 03:15 the next row could have 03:15 / 04:09 and so on however I could have text in some rows. In reality I would like to find and replace the cell.value with the Left 5 characters if the cell contains ANY value maching that format. Text in that column will never have that format combination
View Replies!
View Related
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 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: 1Service LineData AData BEtc. 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 "hiport" i would like to colour only entire row of sheet called "hiport" 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
Summing Values In Column Based On Values In Other Column
I have a vba form with three comboboxes. The first combobox contains a list of employees, the 2nd a list of work activities and the third a list containing hours. As each employee enters the data for their name, activity and hours these values are saved to sheet6 starting at A10, B10 and C10. I want to be able to sum the hours for each employee who enters data. So the completed user form could look like the following: HTML Employee (A) Activity (B) Hours (C) Joe Swept 1.25 Raked 1 Bill Mowed 2 Cleaned 1 Joe Trimmed 1 So as you can see there could be a blank cell in column "A" under Joe and Bill and Joe could come back later and enter more info. What I want on sheet6 say starting at A30 the value Joe would be entered and in B30 his total hours 3.25. In A31 Bill would be entered and in B31 his total hours 3 and so on for other employees
View Replies!
View Related
Sum The Values In Cells Based On The Values Other Column
I want to sum the values in cells E2:P110 based on the values column D. The values in D are formulas resulting in something that appears to match D112 in some cases. I'm using the following equation: =SUMIF(D2:D110,D112,E2:P110) My problem is that D2 :D10 have a formula in it and it's not matching. If I enter the result of the formula, all is good. How should I deal with this?
View Replies!
View Related
Summing Values Based On Another Column
Attempting to sum Book Values for Units. Unit numbers in one column, Book values in adjacent column Some Units have one occurence, others have multiple. Some Book Values will sum up to 0 while most will have a positive value. Attached shows small portion of data that presents range of issues I'm working with.
View Replies!
View Related
Run Macro Based On Values In Column
I am trying to write code that will run a macro based on values in a certain column. I do not know how many rows are present at the time the macro will be run. For example, if Column A has the number 2 in every row then I want macro Z to run. However, if the values are not the same then I want macro Y to run.
View Replies!
View Related
Vba  Formula Based On Used Column + Paste Values
1. In this formula in column C, below, i have A2 as the look up... sometimes this will be A3 , A7 or other... how can i vary this formula? I've tried it all ways. Range("C2:C" & LR).SpecialCells(4).Formula = "=VLOOKUP(A2,Data!$A:$B,2)" It need to be inserted based on the first cell in column A which has a value. 2. after this has done its thing... how can i paste the values to ONLY those cells which have been affected by the formula. I don't want to copy, paste special the whole column as there are sub total and other exciting things included.
View Replies!
View Related
Sum Of 3rd Column Values Based On Nested If On 2 Other Columns
I have three columns as follows: ItemsWeekEnding Count a14/7/2007 10 a34/7/2007 3 a14/14/2007 11 a14/7/2007 5 a44/7/2007 6 a14/21/20078 a44/14/20072 a34/21/20071 a24/7/2007 6 a14/28/20077 a24/21/20074 a94/28/20079 I want to Sum Count values (column 3) for matching WeekEnding (Column 2) and Items (Column 1), example: a1 4/7/2007 15 as a1 for this weekend is occuring twice. I need the formula to do it in excel.
View Replies!
View Related
Changing Values In Column Based On Value In One Cell
Based on the attached (much simplified) spreadsheet, I want the values in the green cells on the "Month" page (B6:B10) to vary depending on the value in the yellow cell (B4), and for these cells to to look up the relevant column in the "Full Year" page  i.e. if B4 (on "Month") = Jan, look up C6:C10 in "Full Year"; if B4 = Feb, look up D6:D10, and so on. I know I can nest IF functions in order to achieve this, but could be a bit messy. I'm sure there must be a simpler formula within Excel ... just don't know what it's called!
View Replies!
View Related
Values In Column Based On Multiple Criteria
Option Explicit Dim lastrow As Long, t As Long Sub Method() lastrow = ActiveSheet.UsedRange.Rows.Count For t = lastrow To 1 Step 1 If Cells(t, 8).Value <> "" Then If Cells(t, 9).Value = "Y" And Cells(t, 10).Value = "" And Cells(t, 12).Value > _ 6 And Cells(t, 12).Value < 60 Then Range(t, 25).Value = 20 End If Next t End Sub Alright, the above code is not working. I am not sure if it is the write part (t,25 value) that is wrong. I want the Y column to be written with a method numbered "20" if the conditions (H is not null, J="Y", K="", and 6<M<60). I have numerous other methods to put in. The reason I'm not doing Case Statements is this is jsut to write the basic code, and then I will have to move it over to ReportSmith using ReportBasic.
View Replies!
View Related
Multiply 2 Values Based Upon Corresponding Column Cells
I'm absolutely new to Excel and I've been trying to workout a formula to to test two conditions if true and derive the data from a 3rd column. In my attached excel file there's a Grade (A) , Status (B) and Mid Point (C) Tables. I'd like it to be formulated in a sense that forexample: IF Grade= 1 AND Status= Q4 RETURN =3750*0.25 IF Grade= 1 AND Status= Q3 RETURN =3750*0.5 IF Grade= 1 AND Status= Q3 RETURN =3750*0.75 IF Grade= 1 AND Status= whatever (I mean whatever I input in this cell then it would retrun 3750 ofcourse satisfying the condition grade= 1) RETURN =3750 IF Grade= 2 AND Status= Q4 RETURN =5500*0.25 IF Grade= 2 AND Status= Q3 RETURN =5500*0.5 IF Grade= 2 AND Status= Q2 RETURN =5500*0.75 IF Grade= 2 AND Status= whatever (I mean whatever I input in this cell then it would retrun 5500 ofcourse satisfying the condition grade= 2) RETURN =5500 ................
View Replies!
View Related
Formatting Text Based On Numeric Values In The Next Column
I am wondering if it is possible to format a cell that contains text  based on a number in the cell next to it. Here is what I have: Category......Mean Results.........3.3 Morale..........3.8 BuyIn..........4.0 I would like the word 'Results' to display in BLACK text because the mean score is in the range 3.03.9 (same goes for the word 'Morale'). I would like the word 'BuyIn' to disply in GREEN text because the mean score is in the range 4.05.0. Basically, the mean scores are calculated using formulas and I would like the color of the category to change based on the mean score number. Is there a way to use conditional formatting to do this? Or another way to automatically make this work? File is attached.
View Replies!
View Related
Delete Duplicate Rows Based On Cell/column Values?
I have a excel file which contains dublicate rows. The duplicate rows can be identified based on few cell/column values. I need a macro to delete the duplicate rows when the below condition is satisfied: let us consider row 5 and row 6: If column 7,12,13,16,17,18,19,23,24,27,28,29,30 in row 5 = row 6 then row 6 has to be deleted. This condition has to be followed for all other rows in the excel used range. Have attached the sample workbook.
View Replies!
View Related
Count Column W/blanks & Values Based On Specific Date
I am in desperate need of a function that will count a column of data where there are blanks and values based on a certain date that will also capture any data that is added after refreshing the table from Access. I have tried several functions but this is what I have: =(ROWS('TouchBack Detail'!$Q:$Q)*COLUMNS('TouchBack Detail'!$Q:$Q))+(COUNTIFS('TouchBack Detail'!$B:$B,'Nov TouchBack Summary'!B$1)). The result should be 3 but it’s including all other cells in the column that are not and should not be included in the refreshed table’s data (Table_TouchBack.accdb). I have attached the spreadsheet for review. The function is in cell B27 highlighted in yellow.
View Replies!
View Related
Updating Values In Variable Ranges Based On Repeating Patterns In A Column
I have a list of two columns. Here’s an example. The left most column provides the row number. _ A B 1 1 0 2 2 1 3 2 1 4 3 2 5 4 2.5 6 5 4 7 1 0 8 1 0 9 2 2 Whenever there are two repeating numbers in column one, I want to reduce certain numbers in column 2 by a certain amount. The amount is determined by half the difference between the number in column B corresponding to the second repeated number and the number in column B corresponding to the row after the second repeating number. The range of numbers that are to be reduced begins with the row after the second repeating number and ends with the last row before number one appears in column A. The values in column A are integers, always starting with one. For example, 1, 2, 3, 4, 1, 2, 3, 1, 2, 3, 4, 5. For the above example, after finding the repeating number two’s at A2 and A3, it would reduce B4 through B6 by half the difference between B3 and B4 (1/2). The values for B4 through B6 would be updated in column B. The same for the next repeated numbers, which is one at A7 and A8. Half the difference between B8 and B9 is 1. Here’s what the updated list would look like: 1 1 0 2 2 1 3 2 1 4 3 1.5 5 4 2 6 5 3.5 7 1 0 8 1 0 9 2 1
View Replies!
View Related
Return Range Of Numerical Values In Single Column Based On Frequency Percentage
I have a single column of numerical values that may repeat many times within the column. I require a flexible Formula: Use an Input Cell for the specified and changeable Percentage(s) %. Column may be filtered – so only take into account Visible Filtered Cells. The Formula will calculate and Return the numerical range of values that fall between the specified percentage % (using the Input Cell) e.g.; 70%. The Formula should Return two numeric values: a Start Value and an End Value – NOT necessarily the minimum and maximum per se BUT the MIN and MAX of the values that appear 70% of the time in the column; therefore, taking into account Repeat / Duplicate values. The calculated Results: the two numeric values will be returned to separate cells on a new Sheet.
View Replies!
View Related
Match The Row Values On Condition
I need a macro to match the row values on condotion. To match the Q column values with S column values. If suppose i have data i lke this then, Q R S 122 yes 22 233 no 38 335 no 42 438 no 45 542 no 50 645 no 750 no then the output should be like Q R S 122 yes 22 233 no 335 no 438 yes 38 542 yes 42 645 yes 45 750 yes 50
View Replies!
View Related
Sum Based On Condition
I want to total column C, but only where column B contains certain data, like add column C where column b contains abd so that i get the answer 7, Hope ive explained it right. B C abd 1 abd 2 bmr 3 abd 4 crc 2 crc 3 bmr 2
View Replies!
View Related
IF Condition True THEN AVERAGE The Values
I'm looking for some help. I need a function that can check if each of two seperate values is less than one. If less than one then divide by 2. Then give me the average of these two values. So it could be that it takes 0.5/2=0.25 for one value and 3 for another to give me the average of 1.625.
View Replies!
View Related
Count Consecutive Values By Condition
I have a spreadsheet with employees performance results for the last 12 months. Column A contains name, columns B to M contain text "Gold", "silver" or "bronze". I need to count how many consecutive months thay have achieved "Gold" status BUT must include latest month. So, if column M contains "silver" or "bronze", the consecutive answer (column N) would be 0. If col M = "Gold" but L doesn't then N = 1. If M and L = "Gold" then N = 2 etc etc. Is there a formula I can use in column N for this without doing 12 "if" functions? I think this needs to be an array formula but the ones I've tried I can't get to work.
View Replies!
View Related
List N Top Values By Single Condition
I want 3 extra columns in the attached sheet which is part of a 62000 row sheet. column d..I want a formula for the lowest ip number(COLUMN C) in each event( event number in column1) printed on all rows in column d fo that event... column e...second lowest ip number for each event.. coolumn f..third lowest ip number for each event..
View Replies!
View Related
Delete A Row Based On Condition
I want to delete a row in excel based on a condition. The condition is as follows: I have few rows in the excel where the columns 7,12,13,23 are same and column 24 in one row has some number and in some other row the column 24 is blank with orange color filled(the colorindex for orange is 44). In this case I want the row with orange color filled in column 24 to be deleted.
View Replies!
View Related
Subtotaling Based On A Condition
I autofilter a list which contains, among other fields, program numbers in column A, account numbers in column B and dollar amounts in column E. I want to display the filtered/subtotal of column E if I select a certain program. Each program has account numbers ranging from 1000 to 8999. I used =SUM(IF()) formulas to separately display totals with account numbers below 8000, and >7999 with no problem. But when I got to create formulas to display the subtotal, I encountered difficulty. I used the following CSE formulas to subtotal sum of column E based on the values in column B, the first formula return 0 (zero), which is incorrect. The second formula appears to ignore the IF statement, and returns the total sum instead of the filtered total. 1. {=IF($B$4:$B$112>7999,SUBTOTAL(9,E$4:E$112),0)} 2.{=IF($B$4:$B$112
View Replies!
View Related
How To Change One Condition Based On Another
I have a "if" statement that goes something like this: =if(and(Function1),do this, if(and(Function2), do that, 0) where Function 1 and Function 2 consist of three conditions each. Now Function 2 has reference to a particular cell (U23), whose value is dependent on other cell references. If U23 has some real value, I want the above statement to be executed. However, if U23 displays a "#N/A", I want only Function1 to be executed. i.e. = if(and(Function1),do this,0)
View Replies!
View Related
Inserting Row Based On Condition
I want to insert a line wherever I encounter a number. I have a range of cells in column "A" with invoices listed and at the end of each customer I have the total. At the total line (the number) I want to insert a line. Right now I can't figure out how get the cell value to recognize a number from a nonnumber data type (bolded area)
View Replies!
View Related
Vlookup Based On 2 Condition
i looking for function, which will give me a results if its the person good , bad and other (Y). It will look based on column A, but if will be more equal names in this column, it looks in the column surname (B) and return value from column (Y) in this row. But it can be more equal column B. Here is an example: Results what i want are in Z1,Z2,Z3 X Y Z 1 sue doe good 2 joe bond very good 3 mark no bad SOURCE table A B C 1 john doe good 2 joe black bad 3 sue doe good 4 mark black not bad 5 joe bond very good 6 mark no bad 7 kat doe bad
View Replies!
View Related
Set A Formula Based On Condition
I have a column called Average and it have numbers from 0 to 100. I want to set a string on another column based on the value of Average. The condition is < 50 is negative = 50 is neutral > 50 is positive For example Column A Column B 45 Negative 50 Neutral 80 Positive
View Replies!
View Related
Insert Row Based On Condition
I would like to write a code, that can check the name of cell A1 with A2. If A1=A2, then insert a blank row between these two rows. I have started with a loop, but somehow it does not work. Sub AddRows () Dim Row As Long For Row = 1 To 3800 If Cells(Row, 1).Value = Cells(Row + 1, 1) Then Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove End If Next Row End Sub
View Replies!
View Related
Sum Row Based On Condition Refering To A Different Row
I have a problem with bringing up the data I need to cells in one row. In row 1 I have dates: 23Nov 24Nov 25Nov 26Nov etc. In row 2 Quantities: 2000 1500 250 750 etc. In row 3 I have dates again (I need to start working towards these qty's): 20Nov 22Nov 25Nov 25/Nov. I would like in column A of 4 row to sum all the qty's (row 2) if the date in row 3 is the same or smaller than in row 1 column A. But in column B and forward I want cells to sum qty's if the date in row 3 is the same as the one in row 1. I have tried : =sumproduct((A3:D3<=A1),(A2:D2)) for cell A4 and: =sumproduct((A3:D3=B1),(A2:D2)) for cell B4 and consequently for others. It comes back as zero value even if I see matching dates/qty's. Does anyone know what shall I change in my formula to make it right?
View Replies!
View Related
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
Delete Row Based On Condition
i have an issue i need to delete entire row if a condition is met, i need syntax if possible to delete if a cell word "begins with" a certain letter ...in this case...letter A column is "O" must search threw entire row
View Replies!
View Related
