Code For AGGREGATE Function
Jan 10, 2008Aggre ABC1Brand Sales 2A5 3B 2 4C7 5A1 6D1 7 8Above are my data 9 10Brand Sales 11A6 12B 2 13C7 14 15Above is the result I want. 16 17 Excel tables to the web >> Excel Jeanie HTML 4
Aggre ABC1Brand Sales 2A5 3B 2 4C7 5A1 6D1 7 8Above are my data 9 10Brand Sales 11A6 12B 2 13C7 14 15Above is the result I want. 16 17 Excel tables to the web >> Excel Jeanie HTML 4
I am trying to create a single cell formula that returns the min value of an array returned from a vlookup function. This is part of a more complex solution that I am trying to implement, but I think I have narrowed my problem down to this issue, so I have created a very simple example to demonstrate.
Cells A1 to B5 contain a lookup table:
table.tableizer-table {border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif; font-size: 12px;} .tableizer-table td {padding: 4px; margin: 3px; border: 1px solid #ccc;}
.tableizer-table th {background-color: #104E8B; color: #FFF; font-weight: bold;}
LetterNumber D4 C3 B2 A1
Cells A7 to C8 contain the input values:
table.tableizer-table {border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif; font-size: 12px;} .tableizer-table td {padding: 4px; margin: 3px; border: 1px solid #ccc;}
.tableizer-table th {background-color: #104E8B; color: #FFF; font-weight: bold;}..................
i have 10 columns, the last one is an amount. What i'm looking for is to aggregate the rows with the same key(columns 1 to 9) just into one and get the summation of the related amounts in the column 10.
Example:
row1: a b c d e f g h i j 100
row2: x x x x x x x x x x 100
row3: a b c d e f g h i j 100
row4: a b c d e f g h i j 100
the desired output is:
row1: a b c d e f g h i j 300
row2: x x x x x x x x x x 100
Just wondering the better way to 'get' a score for some data.
For example, I have a data set where there are a number of records are interrogated for validity across X rules. The returned count of errors of course could include one record for all X tests.....
what is the better way of weighting these to get one score
Please see attached example : XL4M.xlsx‎
To go through all the database files (.txt format) in a designated folder in order to update an Excel Sheet with the required information from those database text files. Then to summarise the information in a simple table.
The text files are individual Market Exports from a game I play, and are titled as "Region-ItemType-YYYY.MM.DD HHMMSS.txt"
eg. "Heimatar-Tritanium-2009.07.02 133353.txt".
I need to know how to sift through the text files to find the most recent one with matching "Region-ItemType" parts in the file name, and refresh the Excel Sheet with the updated data.
After that, I need to be able to combine all of the cheapest sale prices for each item, with a minimum amount for sale (differs per item), while also being limited to location the item is being sold at, into a single sheet of the important information I wanted to extract in the first place.
At the end of the whole process, I need to have a single Excel Sheet with every different item's lowest price for each different place, displayed in a table I can use to make formulas from.
So if I have an export from a place called "place1" and one from "place2", looking at the same item called "item1", I should have two rows of tabulated data, one for each place's lowest price. And this should update at the touch of the "Refresh All" button, or... However you'd have to do it
I have attached a copy of one of the database text files.
I run a golf society and need to set up a golf aggregate sheet that will allow me to enter the players weekly scores and the sheet will then look for the lowest score entered for each player and replace it with their score of this week.
View 13 Replies View RelatedI have column E listing all of the favorites and column G the underdogs, each row represents one game, there are 34 all together. I want a formula to pick the team based on a random generation. That part i have....
=choose(randbetween(1,2),e7,g7)
but here is the rub.
I only want the total number of underdogs to be 20% and the favorites to be 80% of all of the picks.
I am not sure it can be done as each formula must look to what the other formulas are doing...aside from it being circular i think it just impossible or i am not as advance as some of you.
I have a worksheet in which rows have empty column values, e.g.
Name,Column1,Column2,Column3
Bob,Apples,<blank>,Peaches
Joan,<blank>,Oranges,<blank>
Ted,Apples,Oranges,Peaches
Note: The commas above indicate separate columns.
I'd like a formula to evaluate these results and strip out the blanks. Results should look like this:
Bob,Apples,Peaches
Joan,Oranges
Ted,Apples,Oranges,Peaches.
I am using Excel 2010.
I have a large spreadsheet with brands and volumes.
Many of the brands run the same processes, so I can consider them as one.
For example:
Brands - Volumes
A--------10
B--------16
C--------18
D--------20
E--------16
Imagine that A and C are basically the same. So the value that I really care about it (10 + 18) = 28
B and D are the same, so I care about (16+20) = 36
The output I need is:
A&C - 28
B&D - 36
E --- 16
Can I use SUMIF to basically say: Sum this IF =A OR or =B ?
Can I apply an IF function with concatenate to merge the A's with C's and B'd with D's?
The spreadsheet is large and this process will apply to many different groups of brands.
I have a list of employees and their e-mail addresses. There is also a column denoting whether they should be part of an email distribution list or not (if yes, denoted by an asterisk).
I need to aggregate all of the asterisked e-mail addresses in one cell. It also needs to be "active", i.e. having an IF statement for whether or not it has the asterisk and therefore should be included. Last requirement: the addresses need to be separated by a semi-column, then space (for easy copy and paste into Excel) like this:
name@email.com; name@email.com, etc.
I have a book with 250 worksheets, with one cell of data per sheet. It is the same cell in every sheet (C7). I need to somehow aggregate all of this into one column on the first sheet, 250 rows.
View 5 Replies View RelatedI have a database file where users name can be located in 2 neighbor columns. Against each user name (in next 2 cells on the right) there is a evaluation (good or bad).That database will be growing and new additions will be added each month. That means one user can appear several times on a different row with different evaluation.
In the same file I have a separate sheet where I need after running a macros to have aggregated list of users (in one column) and against each user I would like to see how many how many good and bad score he have. It will be good if users are sorted in alphabetical order.
I am providing an attachment with example file.
I have a project where we need to write vba code for an IRR and Payback function.
View 13 Replies View RelatedI am trying to use a cut and paste within a macro.
I have code working fine if I do a copy and paste which is as follows:
The code instead of Vlookup that I'm using at the moment. It takes too long if you have 40,000 to 50,000 rows of data.
The data that I have is something like the sample bebow:
Col A from A1 to A15 with numbers like:
20000000
20000001
20000002
20000003
20000004
20000005
20000006
20000007
20000008
20000009
20000010
20000011
20000012
20000013
20000014
Col C from C1 to C10 with numbers like:
20000000
20000001..............................
I am trying to do is look at the first two digits of the number in column c (Range c5:c5000) if the number starts with 01 then I need the formula in column g = f5*12 if the number is 03 then I want the formula to be g=f5*24 I have several of these "cases" or "if" to put in can someone get me going a little further
Here is what someone gave me to work with but I'm having troubles getting it to work...I get a name error in the cell and I cant use this they way it is because the code needs to go into the sheet mod with a bunch of other code.Also when I use the Option Explicit the rest of my code wont work.
Option Explicit
Function re(Cl As Range, Src As Range)
Dim i As Long
Select Case Left(Cl, 2)
Case "01": i = 12
Case "03": i = 24
End Select
re = Src * i
End Function
=re(C5,F5)
I am trying to use a dynamic range in VBA. But I am getting compile error.
Range("D19:G19").Select
Application.CutCopyMode = False
Selection.AutoFill Destination:=Range("D19").Offset(0, 0, _
Application.WorksheetFunction. CountA( activesheet.name!Master)) , 3)
In the above code Master is a dyanmic range. I need to autofill the copied data in the 3 coloumns.
I have an Excel sheet with a few thousand rows which I would like to filter by a column with the name TrackingID. This column contains values like:
12AA1
23452BA2
234AA1
345635CA2
...
I would like to filter this column by the third character from the end (which is always a letter from the range [A-Z]). In the example above, this would be:
A
B
A
C...................
I am writing some code where one column is selected and a value is searched for in that column. If found the code continues on its way manipulating the data. The issue is that the value being searched for will not always be there which results in an error. Is there a way that I can just tell the macro to continue running if the value is not found.
Columns("V:V").Select
Selection.Find(What:="1", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
Rows(ActiveCell.Row).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
On a second question is there some code I could write that would select all the rows with the number 1 in column V and delete them rather than doing the way I am here?
I've been trying to put together a function in excel which will make it simpler and a bit clearer to produce the coefficients of trend lines in cells. I want to produce an excel function like SLOPE and INTERCEPT but for exponential, power and logarithmic trendlines. For example, I can produce the coefficients for an exponential trendline like this:
Code:
=SLOPE(LN(K2:K11);J2:J11)
=EXP(INTERCEPT(LN(K2:K11);J2:J11))
Ideally, I want to be able to do so without the need to convert the terms with LN function, and be able to replace it with a new function that deals directly with an X Range and a Y range
I've produced the following code:
Code:
Function PowerSlope(YRange As Range, XRange As Range)
For Loops = 1 To YRange.Count
YRange.Value2(Loops, 1) = Log(YRange.Value2(Loops, 1))
Next Loops
PowerSlope = Application.WorksheetFunction.Slope(YRange, XRange)
End Function
However, this causes Excel to crash and shut down (not the macro itself, but the entire program). I can't even get the function to run to a break point in the first line before the crash happens. I'm able to remove the FOR ... NEXT loop and use the function to directly return the result of the linear slope, so I'm confident the issue is not in that part of the code.
I am having problems fixing my function code so that instead of appending myDate with (1) (2) (3) if 3 occurences of the date already exist it just appends it with (3). I know it has to be something simple but I know I am doing something wrong. Thanks for helping a beginner out.
Sub ImportSheets()
Dim fName As String
Dim WB As Workbook
Dim myDate As Date
fName = Dir("N:ENGBRANDON*.csv")
Do While fName ""
Workbooks.Open fName
Set WB = ActiveWorkbook
'Copy first sheet to this workbook
With ThisWorkbook
I have values that I want to color code in my table. Originally I was tagging them as numbers, but instead I need them as colors.
Function conversion(pVal As Double)
If pVal > 0.05 Then
conversion = "1"
ElseIf pVal > 0.001 Then
conversion = "2"
ElseIf pVal > 0.0001 Then
conversion = "3"
ElseIf pVal > 0.00001 Then
conversion = "4"
End If
End Function
Now I want instead of conversion = "1" etc to be
Function conversion(pVal As Double)
If pVal > 0.05 Then
(make white)
ElseIf pVal > 0.001 Then
(make brighter blue)
ElseIf pVal > 0.0001 Then
(make green)
ElseIf pVal > 0.00001 Then
(make navy blue)
End If
End Function
I want the text and cell the same color (number and cell so the number disappears so that I just have a colored cell but the value is still there if I want to look at it).
I am trying to write a function in excel to use the worksheet function "small" In the vba immediate window it doesn't return anything and in the spreadshhet I get a # NAME? error when called in a cell the code is below.
Sub UseFunction()
Dim myRange As Range
Dim answer As Integer
Set myRange = Worksheets("Sheet1").Range("A1:F6")
answer = Application.WorksheetFunction.Small((myRange), 1)
MsgBox answer
End Sub
Whilst stepping through code in any new sub/ function that I create in VBA, VBA Editor (seemingly arbitrarily) jumps to a line in a completely different function.
View 4 Replies View RelatedIs it possible to Call the inbuilt Excel Functions (like VLOOKUP) in Macros. we have to pouplate cells with formula which uses VLOOKUP. one way was to update each cell with required Formula like: [code] Range("A1").value = " = 6*F7*(1-Vlookup(lookupvalue........))"[code] but this was stupid as no of cell to be populated was large and variable and moreover it will return formulae to cells rather than fixed value. What we tried was to defile an table_array as Array(x y) and then use this array to return required VLOOKUP value. However I was thinking is there any way to call function like VLOOKUP in Macros so that we can return a value to cell rather than formula.
View 3 Replies View RelatedI would like a function which works like the NPV function except that the interest rate should be variable and a range rather than a single number.
Is it possible to see the code for the excel NPV function so that I can modify it?
Or alternatively has seen such a function?
How do I translate this to a vba code?
=INDEX('Workers List'!D3:D13,MATCH('Workers List'!C4,'Workers List'!C3:C13,0),1)
what i have done is
test = Application.Index(Sheets("Workers List").Range("C3;C13"), Application.Match(1, Sheets("Workers List").Range("D3:D13"), 0), 1)
But i keep getting an error, may i know whats wrong with it?
It seemed to be working OK for the first hour I had my sheet open. I then noticed that a variation of the following Sub would not update unless I clicked somewhere else in the sheet or edited another non-included cell. It's like something is holding up Excel from running this function and updating the cells if b2 is greater than a3 then a3 will not update to = b2 immediately.
Private Sub Worksheet_Change(ByVal Target As Range)
If [b2] > [a3] Then [a3] = [b2]
End Sub
My data in column B is formula derived and that formula contains data that is live updated data brought in from DDE link.
My question is, should I setup this formula as part of a macro, instead of workbook code and attach an Application.Ontime function to ensure reliable execution? Could too many IF statements cause delays (about 100 of them currently in the code Private Sub Worksheet_Change(ByVal Target As Range))?
I can only export vendor codes from the General Ledger rather than vendor names. If possible, I would like for excel to recognize the vendor code and assign the appropriate name. For example, HCC stands for Human Capital Consulting. The GL includes the vendor code and the voucher number. If I export the vendor code HCC/V0007 from the accounting system to cell A2 in excel, I would like for excel to pick up everything before the / (in this case HCC) and enter Human Capital Consulting in cell B2. I have a vendor list in excel that matches vendor code with vendor. I just need for cell B2 to pick up the vendor code from the list.
I need to write some code that will write a sum formula and include all the cells to the left of the active cell, however this range is variable. I suspect it would be something like:
ActiveCell.FormulaR1C1 = "=SUM(xlLeft)"
but this just enters the formula "SUM(xlLeft)".