VBA Calculating Max / Min Within Multiple Selected Ranges

Dec 25, 2013

I have a problem with using VBA to calculate max/min within multiple selected ranges.

Here is the file: [URL].... I've also attached it below the post.

Column A to D contain the raw data, column G to L contain the trading data. Each trade is marked with "tick" which consists one buy/sell and one close. The entry and close date&time are also included. Then how to match each entry and close date&time from right to left and therefore to look up max/min value within entry and close time from the raw data in the left columns? Respectively, I would like to calculate the min(low) for a buy/close tick and max(high) for a sell/close tick.

The challenges for me:

1.How to match, or reference from the right to left. I knew that "vlookup" could only match one certain value. (correct me if I didn't know enough about "vlookup")
2.The date&time in the left are time intervals while those in the right are time points. How to refer and locate them?
3.In the right side, length of intervals that each tick marked (i.e.from buy to close) are not the same, so should I use a array to contain the length, and then calculate max/min within each? When the data amount get larger, it is not possible to manually use "min" function.

example2.xlsx

View 3 Replies


ADVERTISEMENT

Calculating Time Overlaps With Multiple Ranges?

Jun 28, 2013

how to calculate time overlaps between two ranges using a MIN/MAX formula. Now I need to do the same, but for three (or more) ranges. I have searched and searched, but I can't find a solution. I've attached a sample spreadsheet.

In the example, John is working three jobs, job one from 8AM-4PM, job two from 12PM-2PM and job three from 9AM-11AM. There is a total of 4 hours of overlap, 2 hours from job two and 2 hours from job three. How can I get Excel to calculate that for me?

View 3 Replies View Related

Track Changes On Multiple Selected Ranges On Multiple Sheets

Jul 6, 2007

I need to be able to track changes on selected ranges on multiple sheets, but Excel does not appear to be able to do this. It only appears to allow me to select multiple ranges on the same sheet.

is there a way to track changes on multiple selected ranges on multiple sheets

View 9 Replies View Related

VBA To Select User Multiple Selected Ranges

Feb 9, 2010

The User has made multiple selections with the mouse. The spreadsheet is filtered. The user will usually make different multiple selections on the following columns: A and X through to AR (inclusive).

I just need some code to capture these various multiple selected ranges so that I can copy the selected range as shown below:

View 3 Replies View Related

Excel 2010 :: VBA - Convert Selected Ranges In Multiple Sheets Into One PDF

Feb 10, 2014

I'm using Excel 2010 and would like to know if it's possible to convert selected ranges in multiple sheets into one PDF file? For example, I want to select range("A1:O10) in Sheet1 and range("A1:N25") in Sheet2, then convert both Excel sheets into PDF file with two pages.

View 2 Replies View Related

Calculating Percentiles Of A Selected Range

Apr 12, 2014

What I need is the following: I select a range of numbers and for this range I want to calculate the 1/3th and 2/3th percentile, and these should come in two cells that I can easily change in the vba code.

Some formula in which I can give two inputs: first the range of which it has to calculate the 1/3th and 2/3th percentile and a second input which is just a number and than the vba should say whether that second input is in the first range (between 0 and the 1/3th percentile value) or in the second range (between 1/3th and 2/3th percentile values) or third range (between2/3th percentile value and highest value).

View 1 Replies View Related

Calculating Days In A Month Between 2 Date Ranges

Mar 14, 2013

I've managed to sort the first half of this issue, in that I can calculate the number of days within a given month which fall inside specified to and from date parameters..

The formula I've used is thus :

Code:
=IF(EOMONTH(A13,0)EOMONTH($I$9,0),0,IF(EOMONTH(A13,0)>$I$9,$I$9-(EOMONTH($I$9,-1)),EOMONTH(A13,0)-(EOMONTH(A13,-1))))))

This examines a date value (A13 in this case) and assess whether any days within that month are between the two date parameters specified in H9 and I9.

H9 = 01/01/2011
I9 = 15/05/2011
Jan-11
31

[Code]....

What I need to do now is specify a second set of date parameters in H10 and I10 and add those into the assessment. The dates will NOT overlap.

So, for example, if I were to set H10 as 01/07/2011 and I10 as 15/07/2011, the results would appear as below

Jan-11
31

Feb-11
28

[Code].....

View 3 Replies View Related

Calculating Chart Values Over Large Ranges With Catagories

Nov 4, 2008

I am working on a custom log file for my company. It has 3 sheets and on each sheet is a service type column with drop downs and next to it an amount coumn. Every day that a service issue is requested someone goes in and chooses the service type from the drop down and enters the amount in USD. I want to add charts to the top of each sheet and on the axis i want to have service type and then the total amount spent on that catagory.

View 4 Replies View Related

Calculating Numbers Of Specific Dates Within A List Of Ranges

Aug 30, 2007

One of the spreadsheets we have here keeps track of reservations booked in the following way.

FG
101/05/200801/08/2008
201/06/200801/09/2008
301/06/200801/07/2008
401/06/200801/06/2008

The date in F is the check in date and the date in Column G is the check out date.

There is another spreadsheet in the same workbook that counts the dates that these people are checked in.

For example:
AB
1
2JanuaryRooms Occupied
310
420
530
640
751
863
972
1081
119
1210
1311
1412

As you can see column B7 has one room because of the fact that the reservation check in of F1 started on the Fifth of January

B8 is Three because reservations 1-3 are checked in on the sixth of January

B9 is 2 because reservations 1-2 are checked in on the seventh of January

B10 is 1 because reservation 2 is checked in on the eighth of January

Please note that F4:G4 does not count on this worksheet due to the fact that they checked out on the same day as check in.

I would love any help you could give on this confusing subject.

View 9 Replies View Related

Pasting Selected Ranges Into A PowerPoint Slides

Mar 31, 2009

You will find two attachements to this thread. One is a completed example I found pasting charts into PowerPoint Presentation and the other is my example of what I would like done. Difference here is that I am not using charts, instead I am using selected ranges to paste in a PowerPoint Presentation.

Instead of pasting charts to Excel, I would like to make each colored range a slide in the PowerPoint (Please see attachment).

So by click on the command button "Create PowerPoint Presentation", I would like to have PowerPoint open and the two colored ranges should be in the PowerPoint Presentation as Slide 1 and Slide2.

I have done some research on this topic and found information, but I have not clue as how to do it.

View 13 Replies View Related

Macro Or Function That Changes Value Of Selected Ranges Of Cells

Apr 28, 2009

I am looking for a macro or function (VBA) that will modifiy the value of the selected cell or cells. the code should support selection of one cell, a range or multiple ranges.

I envision the user making his range selection(s). Activating a function or clicking a button that would pop open a modal window. The user would have the option to either adjust the values by a % change (i.e. up or down 7%), or incremental change (i.e. up olr down 100 units). The function would overite the value in the cells.

Has anyone ever done something similar? Is it hard to program?

View 14 Replies View Related

Excel 2003 :: Calculating Number Of Overlapping Days With Several Date Ranges?

Jun 25, 2010

I am having difficulty calculating the number of total overlapping days between several date ranges (6 of them to be precise)

I am using Excel 2003 and my data looks like this:

Sent Out (A) - Received (B)
01/06/2010 13:00 - 30/06/2010 13:00
02/06/2010 13:00 - 16/06/2010 13:00
09/06/2010 13:00 - 10/06/2010 13:00
21/06/2010 13:00 - 25/06/2010 9:44
23/06/2010 13:00 - 25/06/2010 10:56
23/06/2010 13:00 - 29/06/2010 13:00

I really can't wrap my head around the idea of calculating overlap (in network days) between six date ranges and was wondering if any of you would have a solution to this problem.

View 10 Replies View Related

Excel 2003 :: Calculating Number Of Overlapping Days With Several Date Ranges And Conditions

Jan 6, 2014

I am having difficulty calculating the number of total overlapping days between several date ranges for each item in another sheet which has unique items

I am using Excel 2003 and my data looks like this:

Sheet-1 Sheet-2
Item - Sent Out (A) - Received (B) Unique Item Number of days excluding overlap days
1234 01/06/2010 - 30/06/2010 1234 -
4321 02/06/2010 - 16/06/2010 4321 -
1234 09/06/2010 - 10/06/2010
4321 21/06/2010 - 25/06/2010
1234 23/06/2010 - 25/06/2010
4321 23/06/2010 - 29/06/2010

I have used the below formula found from the earlier post but need to add a condition calculating the days for each item.

=SUM(IF(MMULT((NETWORKDAYS(ROW(INDIRECT(MIN(INT(A2:A7))&":"&MAX(INT(B2:B7)))),2)<6)
*(ROW(INDIRECT(MIN( INT(A2:A7))&":"&MAX(INT(B2:B7))))>=TRANSPOSE(INT(A2:A7)))
*(ROW(INDIRECT(MIN(INT(A2:A7))&":"&MAX(INT(B2:B7))))<=TRANSPOSE(B2:B7))+0,ROW(A2:A7)^0),1))

View 6 Replies View Related

Non-Continuous Range In Event Code: Show A UserForm When A Cell In 1 Of 31 Named Ranges Is Selected

Nov 7, 2006

I am using the following Selection_Change Event to show a UserForm when a cell in 1 of 31 named ranges is selected.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
Dim i As Long

For i = 1 To 31
If Not Intersect(Target, Range("StatPost" & i)) Is Nothing And Target.Value = "" Then
If Target.Offset(0, -8).Value = "" Or Target.Offset(0, -7).Value = "" Or Target.Offset(0, -6).Value = "" Or Target.Offset(0, -5).Value = "" Or Target.Offset(0, -3).Value = "" Or Target.Offset(0, -2).Value = "" Or Target.Offset(0, -1).Value = "" Then....................

View 3 Replies View Related

Calculating Median With Multiple Part Numbers That Have Multiple Unit Prices

Dec 27, 2012

I have a list of part numbers which repeat when there are multple prices they were sold at. For each unique part number I need one median price. The list if of about 500 parts but with the various different prices the file is 3700 rows. How can i do this quickly? For each unique part number I need one median price.

View 3 Replies View Related

VBA Code To Copy Selected Multiple Columns To Multiple Rows In Excel

Mar 13, 2014

I want to to copy selected columns of sales data into rows organized by salesperson. I have just started out with VBA and find that I cannot do it myself.

My original data are in the form of the following:

invoice_no
product
sales
qty
total

[Code] .....

I want to display the data in another sheet in the following format:

sales_a
sales_b
sales_c
sales_d

[Code] ...........

View 2 Replies View Related

VBA - Displaying Values In Multiple Lines If Multiple Checkbox's Are Selected

Sep 10, 2012

In my userform I have a list of check box's that can be selected. Currently if more than one is selected, they will appear in the spread sheet in the same line one after another with a space between them. How do I make it so they either appear with a comma appearing after each, so the next value appears on the next line below or most perferably the cell turning to a drop down list with the values?

Current code

VB:
If CheckBox1.Value = True Then ws.Cells(iRow, 2).Value = ws.Cells(iRow, 2).Value & " " & CheckBox1.Caption
If CheckBox2.Value = True Then ws.Cells(iRow, 2).Value = ws.Cells(iRow, 2).Value & " " & CheckBox2.Caption
If CheckBox3.Value = True Then ws.Cells(iRow, 2).Value = ws.Cells(iRow, 2).Value & " " & CheckBox3.Caption
If CheckBox4.Value = True Then ws.Cells(iRow, 2).Value = ws.Cells(iRow, 2).Value & " " & CheckBox4.Caption
If CheckBox5.Value = True Then ws.Cells(iRow, 2).Value = ws.Cells(iRow, 2).Value & " " & CheckBox5.Caption
If CheckBox6.Value = True Then ws.Cells(iRow, 2).Value = ws.Cells(iRow, 2).Value & " " & CheckBox6.Caption

Spreadsheet current cell appearence if all 6 are selected ' Chinnook EH101 Lynx Puma Sea King Fixed Wing'

Required appearence:
Chinnook
EH101
Lynx
Puma
Sea King
Fixed Wing

View 1 Replies View Related

Copy Multiple Ranges From Multiple Sheets And Paste In Order Via VBA

Apr 21, 2013

I've got several worksheets that all have the exact same layout that a user will enter unique information in to each worksheet. Then I've got a final worksheet that I want to have a button that the user can click and when they do, it will look to each worksheet and do the exact same process for each worksheet as follows:

It first looks to see if the worksheet is visible. If it is, I want it to copy the range A5 to K5 down until it gets to the last non-blank cell in column C. The first non blank cell that will be referenced will be C7. Then I want it to paste this information into the range A5:K5 on the final sheet named Sheet8 with the same values and keep cell formatting such as width and height, font. If the worksheet is not visible, it skips the sheet.

I want it to do this for each visible worksheet, placing the next visible worksheet info under the previous visible worksheet info. My current code as shown doesn't do that. It requires that something be inSheet8 A6 before it will even paste, then it pastes the info from A5:K5 but it doesn't do just the values nor does it keep the formatting. What I mean about not doing just the values is some of the info that needs to be copied comes from a drop down they can choose from and it copies the actual drop down menu. Also, it seems to copy all of the ranges from each sheet and paste it into just A5:K5 on Sheet8 and overwrites each other instead of pasting Sheet2 just below the information from Sheet1. So the only information shown after the entire process is completed is the information from the last visible sheet.

If Worksheets("Sheet1").Visible = True Then
Sheets("Sheet1").Range(Sheets("Sheet1").Range("A5:K5"),
Sheets("Sheet1").Range("C7").End(xlDown)).Copy
Sheets("Sheet8").Range("A5").End(xlDown)
End If

[Code]...

View 4 Replies View Related

Print Multiple Ranges From Multiple Sheets Userform

Jun 16, 2007

I inherited a spreadsheet that had an userform where the user checked off which 'pages' he wanted to print. The Ok button routine used if statements to run a routine for each 'page.' Here's an example of the original code for one page:

Sub Button2_Click()
Sheet7.Activate
Run "HorizontalPrintStuff" 'generic landscape pagesetup
With ActiveSheet.PageSetup 'specific pageset settings
.RightFooter = " Construction Assumptions"
.PrintArea = "CONSTRUCTION" 'the named range to print
.Zoom = False
.FitToPagesTall = 1
.FitToPagesWide = 1 'this changes depending upon the page selected
End With
ActiveSheet.PrintOut
End Sub

The problem was it printed each page as a separate print job; and if you print to adobe, you get serveral files, not one file. That and it took a long time to run.

So I tried a different tack. If the checkboxes has true, then the printarea is set to that named range. If there were more than one named range on a sheet to be printed, I consolidated them. I did this with a bunch of if statements - very cumbersome.

Sheet3.Activate
'Sheet3.ResetAllPageBreaks 'disabled due to errors
Run "HorizontalPrintStuff" 'generic landscape pagesetup
With ActiveSheet.PageSetup 'specific pageset settings
.PrintArea = "DEVBGTALL" 'the named range to print
.FitToPagesWide = 4 'this changes depending upon the
.FitToPagesTall = 1
End With

I haven't shown all the code cause it goes on for 12 sheets containing 16 different printareas.

My current muck ups are .....

1) it prints every printarea/named range on a given sheet (I took out all the if statements trying to debug everything.) Is there another conditional argument that allows for multiple 'trues'?

2) the pagebreaks in printarea/named ranges that are multiple pages (like a 48 month schedule) won't stay set. I've tried both VPageBreaks(3).Location:= and .VPageBreaks.Add Before:=

3) the Sheet1.select false argument is always adding a random sheet to the end of the print job. Don't know why.

I can do all this in a recorded macro, just not the selection userform. I've thought about copying to another sheet or hiding columns and rows then printing, but that seems just as cumbersome.

To recap, i want to print out, as one print job, multiple printareas from mulitple sheets, based upon checkbox selection on an userform.

View 6 Replies View Related

Multiple Parameter Lookup For Multiple Table Ranges

Jun 15, 2008

In the attached file i have multiple tables for different types of conservatory roofs (16 of them in total). The ranges at the top and side relate to milimeter measurements and the data in the middle relate to the price for that sized conservatory roof. The table works where the two ranges intercept each other. I have a formula to do this for one of the tables only. What i would like is a way of choosing which type of roof to use (i.e. which table to use) and then to be able to input the measurements and the price to be displayed. All of this needs to be done in one query so its as user friendly as possible. i've had is to use a pivot table, i feel it is not possible to use a pivot table to do this sort if thing after research into them, although i am un-familiar in the making of them

View 4 Replies View Related

VLOOKUP For Multiple Ranges In Multiple Columns

Feb 21, 2013

Im trying to make a vlookup so I can say find a record where column A is >4, B is =2, C is 1.

Example - The lookup would find these 2 ranges.

7
2
3

2
6
4

[code]....

View 1 Replies View Related

Calculating Multiple In And Out Times

Apr 10, 2014

I would like to add up multiple time in and time out for my pay sheet.

As you can see, the total hours worked for Weed A is correct, but the Total Hours Worked for Monday is incorrect. The forumla I am currently using is:

=((B12-A12)*24)+((B13-A13)*24)+((B14-A14)*24)

But I would just like the total hours worked for each day to be the actual hours (2.5 hours).

View 2 Replies View Related

Calculating Multiple Critera

Nov 20, 2007

I've attached a very small spreadsheet where a few cells are highlighted.

These cells are where I can't figure out how to perform the appropriate calculations.

None of the cells can ever be moved. They are linked to AutoCad and MS Access.

I've calculated the few I know how to do, but when there are two types of criteria, I don't know how to set up the formulas.

View 12 Replies View Related

Calculating Costs For Multiple Packages?

Mar 6, 2014

I am having trouble calculating multiple full packages in the attached spread sheet, at the moment the formula is multiplying the number of packages by the price of one full package instead of looking for the correct price for that number of packages. 2014 rates checker formula.xlsx

View 5 Replies View Related

Calculating Multiple Occurances In One Cell

Oct 30, 2009

OK I have included the spreadsheet I am working with and I will try really hard to explain exactly what i want and where my problems lie, so please bear with me.

The work book is separated by months. The individual spreadsheets can have multiple entries in each cell, I have a code running to automatically pop up a comment text box for each entry into that cell to separate each occurrence.

Now I have a separate sheet that will be showing how many times each item has a "hit" or occurrence for the entire month. That's where I have the problem. I don't want to go and count every time i made an entry, excel should do that. The problem I am coming up with is that I can only get it to calculate the one occurrence per cell which does me no good if there were three separate occurrences in that cell.

View 6 Replies View Related

Calculating Conversion With Multiple Skill Agents

Apr 21, 2014

Is there a way to accurately compute a conversion report that has agents with multiple roles? Right now it is done this way:

Agents are skilled to two skills, sales & service. They will make most of the bookings on sales (few bookings on service). I want a report that will calculate the agents who are on sales/service bookings vs calls while persons on service/sales bookings vs calls.

Right now, because the service/sales agents get way less sales calls, you will find that their overal conversion is way higher than an agent who is a sales/service agent. What this does is drive the overall conversion rate so high that it always favour the agents on service/sales, a sales/service agent is always disadvantaged.

Is there a way in excel where i can more accurately calculate this while maintaining some degree of parity?

See report attached

I have highlighted some of the SE/SA agents that are way high

Note: SE/SA = Service/Sales SA/SE = Sales/Service

View 2 Replies View Related

Calculating Number Based On Multiple Variables?

Jan 24, 2014

What I am trying to do is calculate a particular charge based on two main variables the city and weight chosen (each of which will correspond to a particular value) .I have these cities and weights which correspond to a particular price per 100kg when two are selected

My excel data is set up like this

(A).....................(b)......................(c)..................(d)........................(e).........................(F)
.......................Weight..................0-999Kg.............1000-1999kg..........2000-4999kg..........5000-9999kg
1. City
2. Toronto....................................$5.50..................$4.00..................$3.75..................$3.50

3. Winnipeg....................................$3.20..................$3.75..................$3.6..................$3.21

4. Saskatoon..................................$5.4..................$5.2..................$4.90....................$4.70

(I added a,b,c,d and 1,2,3,4 for reference when explaining the formula)

I have a separate row where I am able to enter a weight in one column (A24) and and choose the city from a list in the second column (B24). I need the next column (C24) to display the dollar charge per 100kg from my data that corresponds to the city I have chosen and the weight entered. I am trying to figure out a formula for C24 that allows for instance $5.50 to be displayed when I type in 800kg for A24 and choose Toronto from a drop down list in B24. This row will look like this for reference:

..................A............................ B..............................C.
..................Weight..................City..................Charge per 100kg
24...............800..................Toronto..................$5.50

View 5 Replies View Related

Calculating Multiple Comparisons Over Large Sample

Aug 4, 2009

I have a sample of aproxomatly 30,000 records, and I am working to do some data analysis on it.

I am comparing multiple fields using sumproduct(), but if I go above two criteria, the calculation time becomes incredibly long. Is there a faster way to preform these large comparisons, or am I stuck watching my Excel lag out for 5 min every time I recalculate the sheet?

View 5 Replies View Related

Powerpivot - Combining Multiple Tables And Calculating Across Them

Sep 7, 2013

I'm trying to figure out whether or not something is possible in power pivot. I'd like to load two tables into powerpivot and then set up formulas that create calculated values across the two tables.

Here's a simplified description of what the tables look like. [URL] .........

The pivot table should join the two tables on Month and Category and allow me to create calculated values across the cost category, like this. Note it's filtered to a single cost category right now: [URL] .......

In this view it's filtered to all cost categories but i'd be looking to still maintains the right count of members (i.e. it doesn't inflate the numbers from duplicate records as you might get if you were to join the two tables in a sql database): [URL] ....

The actual tables I would use are quite a bit larger (too large for excel without pp), and have quite a few more of each type of category.

Would something like this be possible to do in powerpivot without having to do some data prep work in another app to join the two tables together?

View 1 Replies View Related

Calculating Working Days For Multiple People

Jan 1, 2009

I'm using Excel 2003, and successfully working out start date (T2 in the formula below) plus duration in days (U2) minus any non-working days listed in a seperate worksheet. =WORKDAY(T2,U2,Holidays!C6:C17)

Each 'task' is on a seperate row, and the lead officer is named in Column E. How can I get the work day function to include the non-working days for each officer as well as the global non-working days in the seperate worksheet? I thought about using a vlookup, but that only matches the first non-working day for each officer rather than all of the non-working days.

View 2 Replies View Related







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