VBA Macro Code For Grouping Based On Column A

May 1, 2014

i need to group the values based on A, B, C columns.

which means all "Chickpea_B-1_11area_3d.csv " will have same timestamp and mean_area_3d values, only D column vlaue changes.....

in the same way, all "Chickpea_B-1_12area_3d.csv" will have same timestamp and mean_area_3d values, only D column vlaue changes.....

now i need all Chickpea_B-1_11area_3d.csv values to be grouped into one. and chickpea_B-1_12area_3d.csv values to be grouped into one..

if you see the output sheet, you will understand clearly, which i did manually for your easy understanding...

i did manually and also attached the sheet for your kind reference and easy understanding... where i grouped all Chickpea_B-1_11_area_3daver_domain_area, fill_factor, leaf_angle_theta, plantHeight, projected_leaf_a into one.... where b and c cols are same for all the D E F G H I Values. in the same way for Chickpea_B-1_12_area_3d and all other below values to be grouped.

like this i have to do for 1000 files. please find the attachment...

View 12 Replies


ADVERTISEMENT

Vba Macro Code For Grouping Data Based On 2 Hours Time

Apr 28, 2014

I need a VBA macro code to get the output like in the excel file which I have attached with this thread. Which means, I need to group the data for every two hours. in the output I need all 4 cols namely A, B, C, D along with extra col namely, interval based on which I need these groupings to be done..

The code has to be really flexible so that it works for all dates and times in the files. Because like this I have to do for 2000 files.....

Original link: [URL] .....

plant area.xlsx

View 3 Replies View Related

Vlookup Using 2 Condition One Based On Devices And Grouping Column?

May 27, 2014

Attach below are 2 sample file and inside it consist of device,grouping and lb1,tb1,ab1. How do I use excel formulae based on 2 condition and set from vlookup with 2 condition file to vlookup with 2 condition 1 file like a vlookup.

View 11 Replies View Related

Code To Delete Rows Based On Status Code In Column

Jul 24, 2009

I'm trying to write a VBA script which will delete all rows in my Excel spreadsheet where Column I (which contains a status code) does not contain the word "Completed".

At the moment, I'm doing this the other way round: my script is able to search for entries in Column I which contain the status codes "Pending", "Awaiting Authorisation", "In Progress" etc and delete them. The idea is that when all those rows are deleted, I'll only be left with rows which have a status of "Completed". This works fine at the moment. However, the concern is that if a brand new status code is added to the data file, my script would be unable to pick it up and delete it. This is a small sample of the code I'm currently using (which deletes all the rows with statuses other than Completed):

View 4 Replies View Related

Auto Grouping Based On Cell Value?

Apr 1, 2014

I'm building a sales tracking spreadsheet and need to find a way to auto group certain rows based on their cell value. In my tracker I'd like to group by company name and be able to collapse it to look at the details.

Here's an example of my starting point and how I'd like the data to look like in the end.

Starting State:
Company Name contact name sales stage Forcast amount
----------------------------------------------------------------------------------------------
Company A david brown contracts 10,000
Company A John Smith Won 20,000
Company A D'Arcy Davis Canceled 10,000
Company B
Company B

Desired State:
Starting State:
Company Name contact name sales stage Forcast amount
----------------------------------------------------------------------------------------------
+Company A 30,000
+Company B

View 1 Replies View Related

Grouping Rows Based On Value Of 9 Cells?

Jun 5, 2012

I have a permutation with repeatition of 3 letters in 9 digits 3^9, and I'd like to be able to group all posibble permutations something like:

BBBBBB+2+1 = BBBBBBCCD = 252 rows
BBBB +3+2 = BBBBCCCDD = 1260 rows
5+4
5+3+1 and so on

View 2 Replies View Related

Sumif Based On Preset Grouping

Nov 19, 2012

I have situation where my account (from trail balance) will present to different grouping based on reporting, example below. How I can formulaize or using VBA to sum to amount based on the format.

Example :

if i want the format b : if i sumif HCM - the total should be from account code a1001,a1002,a1003 and hrd will sum up based from account code a1004,a1005,a1006

Account Code
format a
Format b
format c
format d
format e

a1001
adm
hcm
adm
adm
hrd

[Code] ........

View 7 Replies View Related

Grouping Of Items Based On Same Parts

Oct 21, 2013

I am working with a large data set containing information about certain items

The items are structured so that they all have seven main sections. Within each main section their is a variable number of parts, that the items are made of.

The items uses only one part from each main section. So all items consists of seven (identical) main sections and seven parts.

I am looking to group items togheter which are precisely identical. I mean the items that uses the same part in all the main sections.

Is there an Excel/math wizard out there? I have all the data, but I can't make Excel do this task for me..

View 8 Replies View Related

Speed-up Slow Macro Code: Entries In Column 73 - 85 Will Be Copied From WorkbookRust To The Other Workbook If The Numer In Column 5 Is The Same

Mar 25, 2008

my existing macro, as the run takes to much time to complete. (at least 20min) I've already tried several loops, but no one worked for me. Following situation: There are two excel files, entries in column 73 - 85 will be copied from WorkbookRust to the other workbook if the numer in column 5 is the same. Not every cell within this columns contains data, so the macro should automatically jump to the last entry in each of the above mentioned columns, instead of predefine the range as you see in the code below. After the data is copied to the other workbook, it will be filtered acc. to Sub FilterMain and then copied back to WorkbookRust. As already said, the whole thing works, just to lame.

Sub Allmacros()
Dim WorkbookRust As String
WorkbookRust = ActiveWorkbook.Name
ChDir "C:Documents and Settings vogtMy DocumentsRüstplausch"
Workbooks.Open Filename:= _
"C:Documents and Settings vogtMy DocumentsRüstplauschCH_Revenue_2008.xls"
Sheets("Main_Overview").Select
Windows(WorkbookRust).Activate
Application.run ActiveWorkbook.Name & "!UpdateEntries"
Application.run ActiveWorkbook.Name & "!FilterMain"
'not ask to overwrite existing file
Application.DisplayAlerts = False
Workbooks("CH_Revenue_2008.xls").Save
Workbooks("CH_Revenue_2008.xls").Close
End Sub

Sub UpdateEntries()......................

View 7 Replies View Related

Create Average Based On Grouping Of 3 Columns

Mar 22, 2013

If my spreadsheet has columns A-H.

A is Date
B is Room Number
C is Location
D,E,F all have numbers results in them.
G is the average of D,E,F for each person
H is group average.

If I want to define a group average in column H where it calculates the average of a group that attended the same location, date and room, for each group that attended would that be possible?

So For Example (Columns DEF left out for clarity)

Date
Rm
Location
G Inidivual Average

[Code]....

So because room number changed it calculated as a different group. Is this possible?

View 3 Replies View Related

VBA For Automatically Grouping Rows Based On Text

Jul 7, 2009

I have a pivot table (vendor spend report) which has over 7000 rows of data. There are 38 vendors (some vendors appear multiple times i.e. Accenture Itay, Accenture Germany, etc.). Vendors names are in column B.

I need to have the VBA script search for each of the vendors (and related names) and group them together. Also, last one is for all the MISC. vendors which need to be group together (one's that dont belong to the 38 managed vendors).

Also, I need to rename the Group for each one; rather than Group1, I need to name it "Accenture All" etc...

View 7 Replies View Related

Return Grouping Based On Date Field

Mar 18, 2012

I have a date field 08/09/2011 and want to monitor an item to ensure it's "Approved" before it reaches this date.

The groups are:

Late = this date or past
Within 1 week
Within 2 weeks
Within 3 weeks
Over 3 weeks

How to do this, I tried Nested, and I've tried lookup but I'm not sure how to tackle it.

View 5 Replies View Related

Hide Column After Grouping/Outlining

Mar 6, 2009

When my user clicks a Group by button in Excel (+)(-), I want that event to kick off a macro that will hide columns D and E.

The idea is that when the user views data at different levels of aggregation, the spreadsheet will 'de-clutter' itself by hiding columns that the user doesnt need to see.

There is no obvious Excel event that responds to Group By. Can a Class Module achieve this? If so, can someone give me a 30 second overview?

View 3 Replies View Related

Automatic Response Based On Grouping Criteria Via Macros

Mar 27, 2014

Essentially what I want, is to type a medication in, lets say, A2, and for a macro to produce a response in B2 based off of grouping criteria from another worksheet. My workbook better explains what I would like to see happen. A macro would be best for this, right?

View 7 Replies View Related

Grouping Same Values By A Number Sequence For A Column

Mar 13, 2013

I am trying to group the same values in columns together and i was thinking about having a number count. What's the function that might be able to display this (display whats in Column B in the example below)?

Values
5000 1
5000 1
6000 2
7000 3
7000 3
8000 4
8000 4
8000 4
9000 8
10000 9
10000 9

View 1 Replies View Related

Crosstab Query Grouping By More Than One Field/column

Apr 19, 2009

In access you can create a crosstab query grouping by more than one field/column and totaling on more than 1 field/column

ie Goup by Acc No then Cost Centre
Sum on costs by date -up to 31

View 9 Replies View Related

Grouping Data From Two Tables (different Structure) Based On Common Criteria?

Dec 1, 2013

The attached file shows what I'm trying to do - I'd like to fill in the data in the top left corner table (blue-shaded) with the data combined from the two other tables. Think of the Greek letters as names that are grouped into the groups named {A,B,C,D,E} (the names have no significance, it's just an example).

I was able to do so using an array formula and an extra column (yellow shaded) as you can see in B2 - however, this solution doesn't suite my case because the actual tables will be coming from automated processes and cannot be easily manually altered.

I tried inserting the array formula into the sumproduct formula - see B3 - but for some reason this doesn't behave the same as when the array is outside the formula. I should also mention that I came across a user defined function solution - this too is not so suitable for me right now.

View 9 Replies View Related

Macro/vba: Grouping Data From Csv Then Import Into Excel

Aug 6, 2008

I have a data file saved as csv like this:

Risk Postcode,Effective Year Month,Written Premium,Written Units,Earned Premium,Earned Units,Claim Cost,Claim Count,Glass Manufacture Decade,
2600,200507,0,0,5.7354,0.0765,0,0,1920,
2600,200508,0,0,5.7354,0.0765,0,0,1920,
2600,200509,0,0,7.1693,0.09563,0,0,1920,
2700,200510,0,0,5.7354,0.0765,0,0,1920,
2700,200507,0,0,5.7756,0.0885,0,0,1930

what i want to do is to group the record with the same postcode together and just return one record for each postcode in excel.

so the output will have the postcode, the sum of written premium, written units.

I understand i can use Access to do it, but I want just to use excel for this task.

View 9 Replies View Related

Code To Hide Columns Based On Value Of Another Column

Jul 31, 2014

with a simple code that could:

If column K2:k466 is blank or says "No" then columns L & M are hidden. If it says "Yes" it is not hidden.

Also,

If Column N2:N466 is blank or says "No" then Columns O,P,Q,R are hidden. If it says "Yes" they are not hidden.

Finally,

If Column V2:V466 has a zip code (or number) then columns T,U,W,X,Y,Z,AA,AB,AC are present. If there is no value in any of V2:V466 then they are hidden. .

View 12 Replies View Related

VBA Code To Go Through Column Cells & Return Value Based On Cell Value

Jan 29, 2010

I have been stuck for about a week on trying to create a Case Select macro. I am a novice in using VBA, so I am not sure what I am doing right OR wrong. What I need the macro to do is go through all of the text in a column and if the text is one of the 50 states, I need it to return one specific value, and if it is anything other than one of the 50 states, it needs to return a different value in a column 5 over from the column with the states in it. I have changed the code MANY times and so far I haven't been able to get anything to work. Here's the gist of what I have been trying:

Sub usstates()
Dim R As Range, s As String
Set R = Sheets(1).Range("J1:J50000")
For i = 5 To R.Rows.Count
X = UCase(R.Cells(10, 1))
If X = "AL" Or X = "AZ" Or X = "AK" Or X = "AR" Or X = "CA" Then
R.Cells(i, 2) = "SC"
End If
Next i
End Sub.................

View 9 Replies View Related

VBA Code To Set Unknown Range Based On Current Date In 1 Column

Jul 21, 2009

i have a sheet for monitoring sickness. i have used a macro before which automatically selects a range and emails it to recipients when i press a button. what i would like to do is have excel automatically choose the range for me based on today's day. in the attached example i would like column "A" copied along with the 5 columns before today's date, today's date column and also the 5 columns after today's date. paste the lot into an email and send. (i have highlghted the parts i would like copied and pasted into an email based on today's date (21st july).

View 4 Replies View Related

Date Based Bar Chart Macro Code

Mar 21, 2008

I am working on a manning document which tells me when people report, and depart based on their job position. I have all of the info in one worksheet, and want to generate a bar like graph on another worksheet in the workbook (by just changing the cell color for ease) for a snapshot to view holes in job positions.

The snapshot worksheet has the list of jobs on the left, and months/years in a line acorss the top i.e.

2006
| J | F | M | A | M | J | J | A | S | O | N | D |
Job Position X X X X X X
Job Position X X X X X X

Here was the code I started with, and it doesn't do anything!

Private Sub Workbook_CreateCalendar(ByVal Sh As Object, ByVal Target As Range)

Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim Fcol As Date
Dim Lcol As Date
Dim Lencol As Long
Dim CalcMode As Long
Dim ViewMode As Long
'Set the Start Date of your Sheet
Dim DatTim1 As Date
DatTim1 = #1/1/2006#

View 5 Replies View Related

VLookup - VBA Macro Code For More Than One Column?

Oct 10, 2013

I have 2 sheets, sheet2 have data consist of 5 columns I want to vlook up by vba code so the data from sheet2 with reference here is (ID) search in sheet1 and update the data from sheet 2 to sheet 1 like below. i have found a similar code but it updates only one column that is B cloumn i want to update C, D, E columns and rows by the below code. see the below code.

Sheet 2
Id, beginning, principal, interest, endbalance
123, 10000, 1000, 50 , 9000
789, 8000 , 400 , 150, 7600
245, 5000 , 1000, 200 , 4000
456, 4000 , 1000, 1000 , 3000
789, 2500 , 500 , 100 , 2000

Sheet1
id beginning principal interest endbalance
123 10000
789 8000
245 5000
456 4000
786 2500

Ifound below code suitable for the above query but this is only execute column b , I want to execute c, d, e columns how can I do this.

Sub ADDCLM()
On Error Resume Next
Dim Dept_Row As Long

[Code]....

View 8 Replies View Related

Running Or Bypassing Code In A Macro Based On A Certain Condition...

Feb 17, 2010

I want to be able to run a certain chunk of code in the macro if a certain condition is true, or if that condition is not true then I want to bypass that chunk of code. It doesn't matter if this is accomplished with an if... then... else statement, or some other way.

View 6 Replies View Related

VBA Code To Copy And Paste To Specific Rows Based On Matching Column Header?

Dec 7, 2011

I have a spreadsheet and I was wondering if there is a way to copy from a specific range in say A1:A5 in Sheet1 and paste into Sheet2 where the column matches cell A1 in Sheet1.

I am trying to do this in VBA and I was wondering if there is a way to do this.

View 9 Replies View Related

Macro Code Automatically To Hide Rows Based Condition

Apr 26, 2008

I have a spreadsheet that calculates percentages and then outputs the results to a pie chart. There are 9 different percentages being graphed in cells A41 to A49. The chart looks weird if any of the percentages end up being 0, so I have the formula set to add 0.00001 to each calculation (so they show up as 0% and display on the chart as 0%, but truly are 0.00001). I would like it so that if any of these 9 percentages ends up being 0 (or really 0.00001) that the row automatically hides and thus won't display on the pie chart. How can I create a macro that automatically runs to accomplish this, and automatically updates as percentages are recalculated.

View 3 Replies View Related

Create Surface Chart Via Macro Code Based On Selection

May 28, 2008

I want to write a macro to add a surface chart for a Data Range which includes 6000 data points. But the series selected for the chart don't cover all Data Ranges, only part of them.

Public Sub AddChart2(LastRow As Integer, LastCol As Integer)

Dim cht As ChartObject, currentSheet As Worksheet
Dim rng As Range, newRow As Range, srcRange As Range
Dim colIdx As Integer

colIdx = 5

View 7 Replies View Related

Amending Existing Code To Add New Column To Macro Output

Jun 4, 2014

Attached is my sample data Sample Data_Combine Sheets.xlsm.

What the code in the attached sheet does is that it combines the data in Sheets Set1 and Set2 into the worksheet named "Combine".

Both input sheets share same columns. Code I use is as below:

VB:
Sub BuildPivotData()
Dim wrsht As Variant
Dim i As Integer

Sheets("Combine").Range("A2:AI500").Clear
wrsht = [{"Set1", "Set2"}]
For i = 1 To UBound(wrsht)
Sheets(wrsht(i)).[a2].CurrentRegion.Offset(1).Copy Sheets("Combine").Range("A65536").End(xlUp)(2)
Next i
End Sub

I want to amend the output in such a way that when the macro is run , in the "Combine" worksheet an additional column is added at the start(col A) with header as "Category".

The category should be nothing but the input Sheet name i.e Set1 or Set2.

Here is an example ... Output Sheet.xlsx.

View 3 Replies View Related

Macro Code With Last Column And Row To Recognize Multiple Commands

Feb 13, 2014

The code I have below is relevant to this spreadsheet Copy of Invoice test.xlsm

In the code below I marked the script that has issues in red. The code takes the last row and the last column and works from there. This works fine with single commands, however, when I take a cell (based off the last row and the last column) and try to give that cell multiple commands excel sends back an error. When I use this multiple command (see part of code that is marked in red) for a range that is not based off the last column it works fine.

[Code] .....

View 9 Replies View Related

Speed-Up Multiple Row/Column Deletion Macro Code

Mar 18, 2008

I have the following function in a worksheet module:

Private Function NixEmptyColumnsAndSuperfluousRows()

Me. Range("A1:A7").EntireRow.ClearContents
Me.Range("A1:A7").EntireRow.Delete Shift:=xlUp
Me.Range("BE1").EntireColumn.ClearContents
Me.Range("BE1").EntireColumn.Delete Shift:=xlToLeft
Me.Range("AT1").EntireColumn.ClearContents
Me.Range("AT1").EntireColumn.Delete Shift:=xlToLeft
Me.Range("AK1").EntireColumn.ClearContents
Me.Range("AK1").EntireColumn.Delete Shift:=xlToLeft
Me.Range("Y1").EntireColumn.ClearContents
Me.Range("Y1").EntireColumn.Delete Shift:=xlToLeft
Me.Range("O1").EntireColumn.ClearContents
Me.Range("O1").EntireColumn.Delete Shift:=xlToLeft
Me.Range("K1").EntireColumn.ClearContents
Me.Range("K1").EntireColumn.Delete Shift:=xlToLeft..............

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved