Excel 2007 :: Consolidate Multiple Loop Statements
Jan 29, 2012
I'm working in XL07 on Win7.
The workbook has two worksheets "Data" & "Crunch". "Data" contains the raw data-range B1:U50. "Crunch" is the processing worksheet. Row 1 is a header row. Columns A-D are empty. Column E (rows 2-81) contain the numbers 1-80.
The macro is intended to run in "Crunch". I need to add the CountIf function in every cell/row filling the range F2:BC81. A loop does the trick for me to fill the rows in each column but I don't know how to move the loop down each column without creating a new loop.
A section of the code is below. Notice a majority of the code is the same, the copy in red is variable from loop to loop. I need to repeat this loop through column "BC" (50 times in total). My guess is there is a way to write this code one time instead of 50 times adjusting the variable components.
Code:
'Find total # of records and then store in variable
totalrecords = ActiveSheet.UsedRange.Rows.Count
'CountIf Statement
[Code]....
View 3 Replies
ADVERTISEMENT
Jul 6, 2012
I have a workbook with 4 sheets and with sheet 5 as a "consolidated" sheet. I have to create the macro, which will on a daily basis copy the populated data from those 4 sheets and paste into the sheet 5 (same workbook). The data in the Sheet 5 should be pasted from row 2 below each other.. Row 1 will be the headings and shouldn't be replaced. The data in all 4 sheets should be copied from row starting 37, columns C to BA but it will end with different row numbers. note that columns A & B are populated but shouldn't be copied.
View 7 Replies
View Related
Feb 13, 2014
I am using Excel 2007 and am attempting to write multiple IF statements within a cell. This multi-cell validation would be used to validate that A=B and C=D but A&B do not equal C&D as illustrated below:
ABCD
1111FALSE
1110FALSE
1101FALSE
1011FALSE
0111FALSE
1100TRUE
0110FALSE
0011TRUE
1001FALSE
1010FALSE
0101FALSE
1000FALSE
0100FALSE
0010FALSE
0001FALSE
0000FALSE
Here's the formula that I attempted to use:
=IF(A2=B2, (IF(C2=D2), (IF(A2=C2), "Error3", "OK"), "Error2"), "Error1")
However, I receive an error message stating "The formula you typed contains an error" and it highlights the D in the equation.
I am not sure why the D was flagged as an error. If anything, I thought the "Error" portions would have been flagged...
Is it possible to do a multi-cell validation in Excel?
View 6 Replies
View Related
Oct 12, 2011
VBA in Excel 2007. Essentially, what I am trying to do is this:
I have to two columns (A and B) that have a drop down list in each cell containing text options. I created the drop down lists using simple data validation. Let's say that A has the following options (East, West, North, South) and B has (Up, Down, Left, Right). For each combination of these, e.g., A1 = East and B1 = Down, I want C1 to pull a unique piece of data (a $ amount) from a separate worksheet. I can get this to work in its most basic form but I want to be able to be able to do this for cells in rows 1 - 300 without having to write separate lines of code for each.
Additionally, I am having trouble getting C1 to update automatically once A1 or B1 are changed.
View 2 Replies
View Related
May 6, 2014
I have the following situation and I'm trying to do this using a PC with Excel 2007.
I would like this:
T
N
O
O
[Code]....
The total number of columns will be 11, number of rows will vary.
View 1 Replies
View Related
May 6, 2014
I have the following situation and I'm trying to do this using a PC with Excel 2007.
I would like this:
T
N
O
O
C
O
E
I
M
I
T
[Code] ........
To look like this:
T
H
A
N
K
[Code] .........
This procedure will become part of a macro. The number of rows will vary but the number of columns will be the same (11 columns). I don't care too much about the order since I can later sort. As long as the data from all columns in now in one column.
View 7 Replies
View Related
Feb 8, 2012
I want to loop through a range of cells changing the value of each cell by increments of 0.01 until a value of 10 is reached.
If the loop encounters a blank cell I want it to start the loop at M110 again
If the starting value of cell M117 is greater than 10 then I want the loop to use -0.01 increments to reach 10
If the starting value of cell M117 is less than 10 then I want the loop to use +0.01 increments to reach 10
This is what I have written so far...
Sub Test()
Dim i As Single
i = 0.01
Range("M110").Select
Do Until Range("M117").Value = 10
[Code] .......
View 1 Replies
View Related
Mar 25, 2014
I know about using countifs and or but utilizing sum(countif(..... [all because of this site] - but I have a statement that is quite long and is confusing me when trying to reduce it... if not then I can just use this and it'll be fine... but I would really like to reduce it if possible... here it is:
=COUNTIFS(Data!$A:$A,Sheet1!$A2,Data!$AA:$AA,"<"&Sheet1!B$1,Data!$AF:$AF,">"&Sheet1!B$1,Data!$AJ:$AJ,">"&"30")+COUNTIFS(Data!$A:$A,Sheet1!$A2,Data!$AA:$AA,"<"&Sheet1!B$1,Data!$AF:$AF,"",Data!$AJ:$AJ,">"&"30")
Basically I have a Data sheet that has 19,000+ records that have data from A to AJ... I am tasked with trying to find how many open work orders there are in our company on each given day that were submitted 30 days prior to a specific date. A = Region, AA = Date Submitted, AF = Date Completed and AJ = Days open.
The table looks like this:
1-Feb 2-Feb 3-Feb 4-Feb .........
Midwest 39 39 39 42
Northeast 119 119 120 126
Southeast 46 47 50 54
Southwest 53 53 53 57
West 53 53 53 60
Total 310 311 315 339
View 4 Replies
View Related
Nov 1, 2012
I tried sending this message once before but the system crapped out. At least on my end. If it was sent and this is a partial duplicate. At any rate, as most of you know when an Excel workbook has a large number of merged fields Excel sometimes changes all the cell (not just the merged cells) formats to a Date type, with the exception of those cells that are the Text data type. I found the following code on the net someplace and I can't properly cite the author, that when run resets the cell formats to the default format which is General for all those that had been changed.
Sub CleanStyles()
Dim sty As Style, wbTemp As Workbook
' First, remove all styles other than Excel's own.
' they may have arrived from pasting from other workbooks
[Code]....
This code worked for months. However, it no longer works. I opened the code in the VBA editor and stepped through it using F8. The first time I pressed F8 the first line in the code is highlighted, just like always. The next time I pressed F8 the third line of code (not counting the remarks or blank lines) is highlighted. It did not highlight the Dim statement.
I'm using Excel 2007 in XP.
View 1 Replies
View Related
Jun 3, 2012
I now have XL 2007 but no longer work at the same place so do not have access to the external data source. I would like to view the SQL statements that I wrote back then but keep getting error that I am not connected to external data source and so cannot see my sql statements. I have MS Query 2007.
View 1 Replies
View Related
Dec 21, 2009
how this code can be condensed getting rid of some of the duplicate coding?
Everything is duplicate except for the For i = 1 To x part as the formula that is added is changed from sheet to sheet.
View 10 Replies
View Related
Oct 17, 2008
I have a workbook that has multiple tabs and need help trying to figure out how to consolidate all the data. I find myself spending hours doing this manually each day.
Here is what I have:
Workbook has tabs labeled....Wk1_Mon, Wk1_Tues, Wk1_Wed, Wk1_Thurs, Wk1_Friday, Wk1_Summary......and repeats all the tabs through Wk5....then I have a Month_Summary tab.
I have 25 users with 25 seperate workbooks each with individual information on each workbook.
I am trying to get a sum of all the data on the Month_Summary tab for each month for each user and as well as a sum of the Month_Summary tab for all 25 users.
The end result I am looking for is to get a Yearly Sum of all the Month_Summary Tabs for all 25 users as well as individual yearly summaries for each users.
I have one main Folder which contains 25 folders (one for each user). Under each user folder there is a seperate Workbook for each month.
View 2 Replies
View Related
Jun 30, 2014
my macro comes up with an error on the Consolidate line that says 'Cannot add duplicate source reference'. I have a workbook with a variable number of tabs and I want to consolidate-sum (not copy and paste) the data from the various sheets onto a summary sheet within the same workbook. I'm at the point where it all works fine until it hits Consolidate.
Option Explicit
Sub ConsolidateExport()
'
' ConsolidateExport Macro
[Code]....
View 1 Replies
View Related
Nov 12, 2013
I am having an issue getting an IF statement to work inside a DO loop. I have Microsoft Excel 2007 and Windows 7 Entreprise.
In my Excel spreadsheet, I have in column B a list of keywords and in column C the category to which each keyword belongs. For instance, the keyword "boot" goes withe the category "Shoes", "scarf" goes in "Accessories", etc.
In another column, I have a list of product descriptions (like "Black Boots" or "Silk Scarf") and I would like to assign the relevant category to each product. I thought to do this by creating a new function in VBA. This function would go through the whole list of keywords in column B, checking if the keyword is included in the product description. If it is, the function's result would be the relevant category, and if it is not, the function would search the next line in column B, until a relevant keyword is found, or until the end of the list.
Here is the code I have written so far:
Code:
Function SegmentSearch(Item)
Dim i As Integer
i = 1
Do
i = i + 1
If Application.WorksheetFunction.IsNumber(Application.WorksheetFunction.Search(Sheet5.Cells(i, 2), Item)) = "TRUE" Then SegmentSearch = Cells(i, 3)
Loop Until Application.WorksheetFunction.IsNumber(Application.WorksheetFunction.Search(Sheet5.Cells(i, 2), Item)) = "TRUE"
End Function
Without the loop, the function works fine (if "Item" happens to include the first keyword in the list) but as soon as I try putting the loop I get a #VALUE! error.
View 7 Replies
View Related
Jul 30, 2012
I have two cells = A1 and A2 in which there are words.
What I need the formula to do is if in A1 or A2 is "ABC" or "ABC2" , number 3 is going to appear in B1. If A1 or A2 is going to be "ABCD", number 6 is going to appear in B3.
I have this formula so far that works but cannot add any more arguments.
=IF(OR(A1="ABC",A2="ABC"),Table!F12,IF(OR(A1="ABCD",A2="ABCD"),Table!F13))
(The added numbers are found in another worksheet called "table".
View 5 Replies
View Related
Sep 24, 2013
I'm trying to loop through worksheets as follows:
If ws.Name "DataTable" And ws.Name "Summary" Then ws.Activate
code to do some copy/paste stuff ....
Next ws
Try as I may, I can't get the code to skip the worksheets named "DataTable" and "Summary". Based on other posts, I've tried swapping out the And for an Or. Also tried using LCase(ws.Name), to no avail. Note that I'm acually trying to skip several other sheets as well but only listed two here for simplicity.
I'm using Excel 2007.
View 4 Replies
View Related
Jul 27, 2012
Here is my situation:
Background:
- Excel VBA 2007
- I have a macro that inserts a set of vlookups in range D3:D8.
- When D3:D8 has been filled, I need the macro to COPY the Vlookups in D3:D8, skip down one cell, and paste in the next set of open spaces.
- I have a Do statement that isn't working, and and IF...THEN that quits the loop when a blank cell is found (This means the range of vlookups is no longer needed).
Objectives:
- Fix Do...Loop so it copies D3 throuh D8, skips a cell below D8, and Pastes in the next section? - There will sometimes be only one section to paste in, and sometimes 20. It is dynamic.
Code:
Sub InsertVLookup2()
' This macro inserts the VLookup into cell B2
Dim lastcolumn As Long
Range("D3").Formula = "=VLOOKUP($A2,INDIRECT(""'"" & B$1 & ""'!A:I""),9,FALSE)"
Range("D3").Select
[Code] .......
View 1 Replies
View Related
Mar 8, 2012
using Excel 2007. I need a code to identify a worksheet within a workbook by cell/range value. The book is used by various users. They have the rights to add new sheets and all but delete columns in the 'master worksheet'. The sheet names can be changed by the user but I need to rename the master sheet on opening the file. To do this I have put a specific value in a cell within the master worksheet which then should allow me to find the sheet and rename it. (let say Range A1 has a value of "this sheet") I have a mental block on how i can run a loop to search each sheet for the identifying value until the range and value is found and the sheet identified
View 5 Replies
View Related
Apr 20, 2012
(Excel 2007) The issue I'm having is that a loop statement of mine is failing to recognize that a couple values are equal. It works for the first 3 iterations of the loop, then stops recognizing. I tried copying another set of numbers in the failing one's place, and that actually worked. I can't attach anything, so I'm including a link to a detailed screen shot with some notes on it and code that I'll host on my site. Not sure how else to explain the issue, but if you take a look at the screen shot you can see the excel sheet being worked on and the vba code running. I will also include a text file of the code
Here are the links to the screen shot and text file of my code
Text file
Screen Shot
View 3 Replies
View Related
May 14, 2014
I have a very long routine, looping through 35,000-ish rows several times to detect and delete unwanted items. Occasionally, it gets locked into an endless loop and CTRL+Break will not stop it - I have to kill Excel through the Task Manager.
How can I find out where the endless loop is so I can detect what's causingit and fix it?
View 6 Replies
View Related
Nov 22, 2008
I have three IF statements as below. the problem is if the first statement is true I want it to skip the next two statements or the result will be changed again.
View 2 Replies
View Related
Oct 9, 2012
I was wondering if anyone had any code to loop through every file in a folder and list the file name along with every sheet name in that file? I'm using Excel 2007.
View 4 Replies
View Related
Aug 2, 2014
I am having trouble with trying to repeat or loop the below statements. I am trying to start with applying text in cell "B2" which will hide column "A" on a separate sheet. I want to know if it is possible to repeat the same statement but loop the statement until cell "SL2" and column "SK"?
[If Range("B2").Text = "" Then
Sheets("43mm").Columns("A").EntireColumn.Hidden = True
Else
Sheets("43mm").Columns("A").EntireColumn.Hidden = False
End If
View 3 Replies
View Related
Aug 26, 2013
I have an Excel Spreadsheet (2007) that contains over 500,000 records that shows Electric meter usage per month over a 24 month period per meter. What I want to be able to do is to select a meter row per number and copy is to it's own worksheet. At the end - I want to be able to have a seperate worksheet per electric meter number - that I can create a graph. If I go through all 9000 meters and copy and paste into a different worksheet - it will take me weeks to do manually. How can I do this automatically?
View 1 Replies
View Related
Mar 24, 2012
I have a column of cells with Customer info and address in each row, that I need to move into multiple columns. ie Cust name, acct #,address, city,state, zip the problem is ALL of the info for each customer is in ONE cell.To be clear, cell B1 has complete name address etc for one customer, B2 has the info for another, B3... on and on. To complicate matters as in the example, there is not a pattern in the lines. the first example shows the info beginning on the 2nd line of the cell, but the 2nd example shows info in the first line. I have tried the text to column fixed width. Didn't work because names and addresses are of varying lengths. Then I tried delimited, but there isn't a common separation between different data. I am using excel 2007. FYI I did go through many many threads and found some that were close to my problem but not close enough to work.
"
JOES TOWING SERVICE [0123451]
123 STREET
CALEDONIA FL 12345
"
"BUBBA / SHOP
ACCURATE AUTO SUPPLY INC [0234567]
21234 HYDRAULIC DR
LOCKWOOD OR 45678
"
View 7 Replies
View Related
Feb 8, 2010
I was playing aroung some VBA code, but the code executes 98 times and I don't know why. For example, range A1 contains 5. When I type, say 3, in A1, I want A1 to show me 8 (5+3). Then I may type 10, in this case A1 must show 18 (8+10). And so on. I decided to place entered values in different column, then sum them in A1 with below stated code
View 3 Replies
View Related
Jul 12, 2014
I need a macro that would consolidate all data in multiple worksheets of multiple workbooks in one Master file.
All the workbooks will be in one particular folder. The macro should search for data in all the workbooks and consolidate it in one master excel workbook.
I am currently using both excel 2007 and excel 2010. This macro would really reduce manual work as currently consolidating data from 45 to 50 sheets takes an ample amount of time...
View 4 Replies
View Related
Oct 6, 2013
I have use excel 2007. In our sheet i have in cell "B3" product name i.e. "abc" , "xyz" etc. That is called sales of goods.
In cell "C3" i have number of quantity
If "B3" is "abc" then only calculate below :
1st option : If product name is "abc" then only calculate (which is cell "B3") & cell "c3" is >=15 & cell "c3" is<19 then message shown as "one mobile free"
2nd option : If product name is "abc" then only calculate (which is cell "B3") & cell "c3" is >=20 & cell "c3" is<39 then message shown as "two mobile free"
3rd option : If product name is "abc" then only calculate (which is cell "B3") & cell "c3" is >=40 then message shown as "three mobile free"
In view of the above which formula applicable.
View 4 Replies
View Related
Jul 15, 2014
I have Excel 2007, and I have column 1 with a thousand entries "HC 14-0001" all the way down to "HC 14-1000". I have on my hard drive 1000 foldiers named the exact same "HC 14-0001 to HC 14-1000". I want to create a Hyperlink from each item in that column to its corrisponding folder on the hard drive. I can easily create the Hyperlink, but I want to find someway to copy them. I can create the first two rows... HC 14-0001 and HC 14-0002 and create good Hyperlinks to the folders, but when I highlight them and drag them down, the excel spreedsheet is updated all the way to HC 14-1000, but the Hyperlinks do not change.
How can I get the Hyperlinks to change? I don't want to spend the next week creating Hyperlinks for a 1000 entries on this spread sheet, and I have 5 other spreadsheets exactly the same.
View 13 Replies
View Related
Jun 27, 2011
I'm looking to simply find a function that allows me to lookup a certain value in a table of data and return the value in a specific column. So if I looked up the current date, 6/27/2011, it would return the week it is in (26). I dont want to be limited to just the monday column however, as the dates I will be throughout the entire week. Is there an easy way to do this in excel 2007?
MondayTuesdayWednesday ThursdayFridaySaturdayWeek
5/2/20115/3/20115/4/20115/5/20115/6/20115/7/201118
5/9/20115/10/20115/11/20115/12/20115/13/20115/14/201119
5/16/20115/17/20115/18/20115/19/20115/20/20115/21/201120
5/23/20115/24/20115/25/20115/26/20115/27/20115/28/201121
5/30/20115/31/20116/1/20116/2/20116/3/20116/4/201122
6/6/20116/7/20116/8/20116/9/20116/10/20116/11/201123
6/13/20116/14/20116/15/20116/16/20116/17/20116/18/201124
6/20/20116/21/20116/22/20116/23/20116/24/20116/25/201125
6/27/20116/28/20116/29/20116/30/20117/1/20117/2/201126
7/4/20117/5/20117/6/20117/7/20117/8/20117/9/201127
7/11/20117/12/20117/13/20117/14/20117/15/20117/16/201128
7/18/20117/19/20117/20/20117/21/20117/22/20117/23/201129
7/25/20117/26/20117/27/20117/28/20117/29/20117/30/201130
8/1/20118/2/20118/3/20118/4/20118/5/20118/6/201131
8/8/20118/9/20118/10/20118/11/20118/12/20118/13/201132
8/15/20118/16/20118/17/20118/18/20118/19/20118/20/201133
8/22/20118/23/20118/24/20118/25/20118/26/20118/27/201134
8/29/20118/30/20118/31/20119/1/20119/2/20119/3/201135
9/5/20119/6/20119/7/20119/8/20119/9/20119/10/201136
9/12/20119/13/20119/14/20119/15/20119/16/20119/17/201137
View 4 Replies
View Related