Retrieving Variable Rows From Another Worksheet: Reducing "Calculation Time"
Aug 10, 2009
I'm using this formula to pick all rows from a huge range of cells "DATA" in another sheet, by matching the first column value (SAPDATA is the range that contains all the first column cells of DATA).
All possible first column values have been stored as a dropdown in cell D4, and whenever I change the choice in the dropdown cell, the retrieval of those hundreds of rows takes ages in excel.
=SUMIF($A:$A,">="&TODAY()-1,D:D)-SUMIF($A:$A,">"&TODAY(),D:D) calculates the total in Col D looking back from today. The results gives you 12:00. What I need is a formula that will look back from the current time to 24 hours in the past, NOT 1 day, to calculate the total in Col D. Looking back 24 hours, from 10:00am, the results would be 6:00.
Since the first time on 12/12 has not arrive, it will not calculate it, but will look back from 10:00am on 12/12 to 10:00am on 12/11 and calculate a result of 6:00 hours.
I have a rather large spreadsheet that takes a long time to calculate. One sheet has the data (about 2800 rows by 650 columns), with samples in rows and data for each sample in the columns. A second sheet has functions to group the data according to predefined patterns. That second spreadsheet is about 800 columns wide and as many rows as I need it to be, as the samples don't need to be analyzed all at once.
Ideally I would like to do all samples at once by making the second spreadsheet 2800 rows high, but the calculation time is just way too long. And there's the problem. The calculation time seems to increase exponentially with the number of rows I calculate at a time. I ran a few tests making it different sizes, and here are the results:
rows time(seconds)
100 3.5 150 12 200 23
[Code]...
I tried both HLOOKUP and INDEX/MATCH functions and it didn't make a lot of difference. These numbers are for INDEX/MATCH.
Graphing these numbers show that it follows an exponential curve pretty closely. What is interesting is that the progress indicator at the bottom of the screen finishes in a few seconds, about 5 seconds for 350 rows, and I can see the new data after those few seconds. But then it sits and appears to do nothing for the rest of the time. So, for 350 rows, it looks to be done with the calculations within 5 seconds, but then it freezes for another 2 minutes with CPU usage maxed out before I can do anything with the program. That actual calculation time seems to scale linearly with the number of rows I calculate, but the time after it finishes calculating before it finishes whatever else it's doing scales exponentially.
The spreadsheet does have a macro and a couple of other sheets and a macro that do some later analysis and I wondered if that had something to do with it. To check that, I created a new spreadsheet and set it up the same as the original one, with the data in one spreadsheet and the INDEX/MATCH formulas in the other. I copied the data over, but setup the formulas new without copying/pasting anything. It didn't make any real difference.
I have a piece data acquisition hardware which stores data every 5 minutes into an excel sheet, I need to reduce the resolution of the data to every 30 minutes, currently I am doing this by deleting five rows leaving one and repeating the process, there is however 9285 rows I am assuming there is a macro which can do this far quicker than me.
Column A has alphanumeric data that can appear, once, twice, 3 times or 4, but never more than 4.
I want to see this spreadsheet so that each piece of data in column A is presented only once.
The information in the other 3 columns isn't important for what I want to do, so I need to reduce 20000 + rows, which includes many duplicates in Column A to about 5-60000, but need help figuring the correct formula/macro ....
I have something like the following that has a name and a time associated with it for each given name:
A23-Mar-122:27:18 AMB24-Mar-123:38:56 AMD23-Mar-123:38:44 AMA23-Mar-1210:52:01 PMB24-Mar-122:43:26 AMD27-Mar-123:05:07 AMA27-Mar-123:05:16 AM
What I am looking to find is for that that name (i.e., A) what the earliest entry is for the given day (and put in Start Time). The same for end time but to have that the latest time for that given day.
3/23/20123/24/2012Start TimeEnd TimeStart TimeEnd TimeA2:27:18 AM10:52:01 PMB2:43:26 AM3:38:56 AM
The user is asked for one piece of information "Enter the ID Number.
What the macro should do then is go to Wks1 find the ID Number and change some cells as a result. This bit works.
Set Wks2 = Worksheets(strWks)
7 rows from the bottom.
My intention was to capture the the name of another worksheet which is held on the same row as the ID Number on Wks1 and call it strWks.
Then further down the macro set the value of Wks2 to that of strWks so that the macro will then go to that sheet and remove data from the row with the same ID Number.
I get a Time Run Error 9.
It just seems to be the bit at the bottom where I am trying to identify Wks2 using strWks.
Sub Macro01C_Auto_Resign() Dim Wks1 As Worksheet, Wks2 As Worksheet Dim strFind As String, rngFound As Range Dim lngRow As Long, rngUnion As Range, strWks As String ............................
Due DateInvDocument numberDebitCreditBalance 17/09/08L01607610714211201825.44 13/10/08L01637010284345841020 13/10/08L01637131713874501020 13/10/08L016373852202473461020 13/10/08L0163748.5222E+111020 15/10/08L01641811103746832316
The above is a part of a w/sheet. Rather than determining the last row in the debit column and credit column (to know which is greater) and use a loop to put a formula in each of the cells in the balance column (adding the debit and credit), I know I can use the with ... statement to input the formula at a go , but cannot figure it out.
Sub sumtotal() With Sheets(1) With .Range("G14", Range("G" & Rows.Count).End(xlUp)) .Clear .Formula = "=sum(E14+F14)" On Error Resume Next
Adm Date Adm Time Trans Date Trans Time 1/16/2014 937 1/16/2014 1045 1/1/2014 121 1/1/2014 121 1/14/2014 800 1/11/2014 735 1/30/2014 100 1/30/2014 205 1/13/2014 800 1/12/2014 1202
I would like to calculate the difference (# hours spanned from the dates shown). Unfortunately when we transfer the data the COLON is dropped from MILITARY TIME so I am having problems in the calculation. This is also made more difficult as some of the calculates span over two dates.
retrieve the multiple rows of data from one specific item to another worksheet inside same workbook. below attachment is my sample workbook.
inside the workbook, eg.. please have a look on Sheet 3 (the record of the item and its description) will store on Sheet 2. From sheet 1, when user choose the item from drop down list, and click the button will direct to the retrieved result in sheet 2. my question is i cant retrieve the multiple rows of data exactly in the sheet 2. it only remains one item for one row of description.
and below attached picture is what i wish to achieve =)Capture.PNG
I'm fairly new to macro's and VBA, by searching on the internet i've copied and pasted some code together into a macro. But it ends in a Run-time error 91...
The macro opens a target .xls file in a selected folder, performs copy - paste actions from masterfile to targetfile. Than it filters data in the targetfile sheet1 and copy's the results to the various other sheets; saves and closes the targetfile. The next target file in the folder is opened and the actions are repeated in this second target file. For the first target file this works smoothly; but for the second one (of a total of around 100) it does not copy the filter results to the other sheets in this workbook. The error message i get is: "Run-time error 91:Object variable or with block variable not set." When i hit debug it highlights the line "ActiveSheet.Next.Select" which, at least in the first file, seems ok.
Im trying to access data from 2 different cells (say A1, B1), its for calculating transformer hotspots. The cooling method of the transformer is naturaly air cooled oil.. until the winding temp reaches 75C ( I have winding temp data laid out on a column) then the fans come on and some constants in the formula change (need to read from the other cell, say B1) so it switches, but the fans stay on UNTIL the winding temp is 50C and then go off, so the characteristics change back to the previous one, so I need to switch back. How do I go about doing this... my current method starts working when it reaches 50 instead of waiting the temp to go to 75 then fall to 50 then do it... im a bit confused.. maybe i shouldnt be doing this on excel... ow well
I am trying to develope a "goto" page macro where the page value maybe 1,34,7A, 256C etc. I am not clear on how an inputbox value can be compared to a string variable or a numeric variable at the same time. This is what I have done, but when the texboxvalue is "7A" it doesn't work.
I am trying to make a calculation using variable text.
My outcome cell is D3 and my two variable cells are C3 and F3. In C3 I want to be able to insert a staff members name, of which we have 6 different members of staff. In F3 i need to insert the week number which runs 1 through 6. The outcome is the individuals place on the week roster which needs to be a number between 1-6 inclusive. SO basically if F3=1 & D3=J.SMITH then I need D3 to equal 1 keepng in mind that if F3 & D3 have 6 possible variables.
I am having a lot of trouble finding out why I am getting error. I believe the error is because it can't find the number. In cells C115:C314 i have the numbers 1 to 200 in order. when someone types in 1 to 9 in the text box it works, but on 10 and over i get the error ???? here is the code I have
Function Find_Range(Find_Item As Variant, _ Search_Range As Range, _ Optional LookIn As Variant, _ Optional LookAt As Variant, _ Optional MatchCase As Boolean) As Range Dim c As Range If IsMissing(LookIn) Then LookIn = xlValues 'xlFormulas If IsMissing(LookAt) Then LookAt = xlPart 'xlWhole If IsMissing(MatchCase) Then MatchCase = False With Search_Range Set c = .Find( _ What:=Find_Item, _ LookIn:=LookIn, _ LookAt:=LookAt, _ SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=MatchCase, _ ........................
Using the message box I see that sheet 1 opens but then I receive an error message Run Time Error 91, Object Variable or With Block Variable not set. I tried declaring and using set on "project" but got nowhere. I also need to have a message indicating project not found. Once this part is solved I will loop all of my other workbooks
Need a point in the right direction with this one! I want to calculate the difference between two time values, the problem is there two different formats as below:-
1) 520.00 - this is a number format
2) 500:00:00 - this is a time format HHH MM SS
What could I use to show I have a 20.00 hour difference???
I currently have a userform which inputs data into two cells, the third then multiplies these two cells together, which is all honky dory. It works, 2 x 2 = 4. But when i put 0.6 for example it really doesnt work. 0.6 x 25 = 25. WRONG. My code in the macro is fairly long winded but will paste anyway.
If ComboBox2.Text = "Pounds (£)" Then Sheets("Claims").Range("G16") = TextBox2.Text Else Sheets("Claims").Range("F16") = TextBox2.Text End If
i need to total a range of cells, however, these contain time values; hh:mm:ss. it shows me the total when all cells are highlighted. but =sum() doesn't work.
I have been burning brain cells trying to figure this out. I get these numbers from an online source and they come in like this:
A B C D E 1/1/0912:01AM02:40AM11:18AM07:55PM
The times do not come in as times...when I format the cell to time it doesnt change...that is my first problem.
What I would need to do to these times is: take B and C and find what time is in the middle of them and put that in a different column.
This mess will also need to be plotted on a chart with time by the minute for one day as the X axis. In my example I drew lines on the chart to show what I mean....the blue lines I dont want charted...I use those to find the time in the middle.
I am trying to get a total column that will give the total only when two particular devices are down at the same time. This total will be taken from a long list of downtime entries for different devices but I only want the total when two particular devices are down, for example
Devicedatedowntimedateuptimetotal time 102/01/0911:00:0002/01/0911:09:0000:09:00 202/01/0911:00:0002/01/0911:04:0000:04:00 202/01/0902/01/09 103/01/0903/01/09 303/01/0903/01/09 604/01/0904/01/09 204/01/0913:09:0004/01/0913:12:0000:03:00 104/01/0913:02:0004/01/0913:15:0000:13:00 505/02/0905/02/09 total 1/200:07:00
In the example I am just wanting to work out the total time when both device 1 and 2 were down at the same time, above the total would be 7 minutes because for 4 minutes on the 2/1/9 and 3 minutes on the 4/1/9 they were down at the same time.
Having been looking round this site for quite some time now and always finding what I needed I am now a registered member who needs your expertise.
I have a spreadsheet for which I need to calculate hours worked depending on a few criteria.
[data] ...
The criteria is that Sat/Eve is 8pm to 6am weekdays and midnight to midnight on a saturday. Sun is midnight to midnight on a sunday, BH is a bank holiday and basic is everthing else. What I want to know is it these columns can be populated automatically using formulas.
I would really appreciate it if someone out there is up to completing this challange, as I have to manually populate this at the moment and it can be 5000+ lines long (it takes hours). If i need to change the layout it's not a problem, whatever it takes to automate it has got to be worth the effort.
I have a time card sheet that I want to make automatically calculate the time I have worked. It is set up with four columns that can't be changed. The first column is "Time In(TI)", second column "Time Out(TO)", Third column "Time Taken For Lunch(TTFL)", and Finally "Hours Worked". I have no problem getting the formula to calculate the difference in "Time In" and "Time Out" but taking the 30 minutes out of that is causing a rift. If I put the 30 minutes in 00:30:00 format it will take it but it thinks it's 12:30:00 and it displays in 00:30:00 which I want it to display 30. Just to clarify, I am using =(TI-TO)-TTFL in the Hours Worked cell.
On the attached Excel file, I have code that will insert a variable number of rows and copy and paste from and to variable positions. That all works fine when run from a command button, but when I try to run it from the Worksheet_Calculate by entering 1 in J1 or K1 (inrange cell is J1+K1 for testing purposes) the CommandButton1_Click sub runs continously until an error occurs.
I am a big fan of huge files (30MB+) all interlinked with array formulas ...and lots of them. The problem is...one calculation take literally 5 hours. (I have one file I try to calculate since cca 4 hours now...it's at 63%)
I keep getting extra memory with no visible improvement on the processing time. Is there a trick out there that I can use? Something is clearly wrong.
I feel I will soon have to give up Excel, or my formulas, or my job ...
I have a calculation whereby I use two variables which are 1. Man hours left in the week formatted as [hh] and 2. Amount of work left to do in the week formatted as 0" Man Hrs" I need to carry out a calc which says:- Man hours left in the week - Amount of work left to do in the week.
The answer should tell me if I have a deficit or surplus of hours which can then use for planning purposes. Unfortunately the problem I have is that I can't make the formatting the same for both unless someone knows of a workaround.
Man hours left in the week = 128. Man hours required to complete all work this week = 224. Therefore I need to say 128-224 = -96. However when I do this this an answer of 16 is returned.
I have attached excel sheet. Column A consists of List of LAN numbers, Column B consists of List of Documents tagged & Column C consists of time at which particular document is tagged.
I need to calculate the time taken to tag all the documents in Lan1/Lan2/Lan3 in Column D. (I can ignore the date by doing text to columns).
I am trying to calculate the response time between when a phone call comes into my workplace and when the responder calls back...I have created a formula that does this using the times and dates of when the calls were recieved and went back out. This works except when the call comes in on one day and goes back later in the day the next day, making the response time larger than 24 hours. I also have it set up to eliminate 15 and a half hours from the calculation because our place of business is not open during this time. Further details....
The formula currently being used is... =IF(G50=E50, H50-F50+(H50
I need to find out the total time an issue was 'open' (not resolved) during business hours. Issues come in and resolution time is based off of a priority. Priority 1 should be resolved in one hour, Priority 2 should be resolved in 4 hours, Priority 3 should be resolved in 1 business day (8 hrs), Priority 4 should be resolved in 2 business days (16 hrs), Priority 5 should be resolved in 5 business days (40 hrs), Priority 6 should be resolved in 10 business days (80 hours).
I have start dates/times field in a column (mm/dd/yyyy hh:mm) , a resolution dates/times field in another column (mm/dd/yyyy hh:mm) and a priority in another column (1-6). I need to calculate the time an issue is in open status (not resolved) based on it's priority but I need for it to take into consideration business hours (Monday thru Friday...7 am to 7 pm)...and not calculate time outside of 'business hours'.