Optimize Cut Lengths

May 20, 2009

I have a given length of steel bar...Example(550 feet)

I have various cut lengths that I can pick from...
14'-10".....13'- 9".. 12'-8"........(up to 6 different lengths)

I need to know the best combination of lengths to cut the long bar into to have minimal scrap left when we get to the end of the 550 feet.....

Cut as many of the longest cut lengths possiable.....Cut as few of the shortest cut lengths possiable

Due to the fact that I will have to convert this to a PLC application when completed, I want to find a mathmatical way to do this inside excel and not use the "solver"....Assuming that I/we can come up with an equation to do this .....

View 14 Replies


ADVERTISEMENT

Optimize Calculation Speed

Mar 24, 2009

I have a rather large spreadsheet that takes a very long time to calculate once the new data is added. One of the many things I need to do is look to see if a unique value in range 1 is also in range 2. If it is, return some data (vlookup), if it's not, then I want a "0", not #NA. My question is, which of these two methods will result in a faster calculation (if at all):

Option 1: Do it in one step
=IF(ISNA(VLOOKUP($A3,LY,3,FALSE)),0,VLOOKUP($A3,LY,3,FALSE))

Or option 2: Do it in two steps:
Column N formula:
=VLOOKUP($A3,LY,3,FALSE)

Column N+1 formula:
=IF(ISNA(Column N value),0,=column N value)

I have many columns of data using formulas in option 1, so if I have coded this badly that could be my problem...

View 9 Replies View Related

Optimize Restructuring Macro

Apr 29, 2008

This macro accepts analytical files of constant format, imported into individual worksheets. Each file contains header information, followed by bulk analyses. Header information is extracted and used to tag individual records within an array. A unique header is created for each analytical method and erroneous values are treated. The array is output to a new worksheet, then the macro loops, repopulates the array, attempts to match the headers of the current array with those in the output worksheet and writes records in the corresponding column.

I'm particularly concerned with the section entitled "Match columns to headers" as this involves several nested loops and seems very inefficient.

As it goes, it works. However, as I intend to develop the macro further into something more versatile, it seems sensible to get the fundamentals correct.

Sub Format_Assays()

Dim batchId As String, inArray() As Variant, i As Integer, j As Integer, outRow As Integer, outCol As Integer, outSheet As Worksheet, sExist As Boolean, wSheet As Worksheet, x As Integer, xout As Integer, y As Integer, yout As Integer

'Cycle through required sheets
For Each wSheet In ActiveWorkbook.Sheets
If wSheet. Name = "Assays_All" Then
sExist = True
Exit For
End If
Next wSheet

View 9 Replies View Related

Optimize VBA Loop For Inserting Formula

Aug 4, 2009

I have a spreadsheet with 10,000 rows. In column A dates are mentioned and in column B I'd like to calculate the specific Quarter via VBA code as I can't have formula's in my sheet.
My VBA code is:

Sub QuarterCalc()
Dim myCell As Range
Application. ScreenUpdating = False
For Each myCell In ThisWorkbook.Sheets("Data").Range(Cells(1, 2), Cells(10000, 2))
myCell.Formula = "=INT((MONTH(RC[-1])-1)/3)+1"
myCell.Offset(0, 0) = myCell.Offset(0, 0).Value
Next
Application.ScreenUpdating = True
End Sub

View 9 Replies View Related

Speed-Up/Optimize Recorded Macro Code

Aug 30, 2006

Im setting up a spreadsheet that does engineering calculations. Im using macros to run sizes from a standard schedule. It basically takes the values from one sheet (schedule) to another (calculation), then the result from the calculation sheet (Value only, not the link) is pasted back into the schedule. The macro seems very bulky and im sure that it can be made more efficient with a loop. here is a sample of the code from the macro;

Sheets("Calc sheet").Select
Range("C6").Select
ActiveCell.FormulaR1C1 = "=Schedule!R[1]C"
Range("C7").Select
ActiveCell.FormulaR1C1 = "=Schedule!RC[1]"
Range("C8").Select
ActiveCell.FormulaR1C1 = "=Schedule!R[-1]C[2]"
Range("C9").Select
Sheets("Schedule").Select
Range("G7").Select..................

View 3 Replies View Related

Optimize Slow Conditional Formatting Code

Jan 23, 2008

I am having a little trouble with this code, which runs in my simple but efective ressource overview. It loops through a rather large range and assigns interior colour to the cells based on certain criteria. On my stationary machine (Excel 2003) it takes approximately 15-30 seconds to run the code which is acceptable. On my laptop (Excel 2007) it takes 5+ minutes which is unacceptable. Is there a workaround so as to optimize the speed? Further, when I run this workbook on Excel 2007, even entering an integer in the sheet takes 3-4 seconds, and no code is running! In my first version I used a Change_Event to colour cells on the fly but this was slow and prevented multible cell editing as well as pasting values into the appropriate range.

Public Sub Farvelade()
Dim icolor, Navn As Integer
Dim TargetRow, LastRow, Previous As Long
Dim Target As Range
MsgBox "Det kan tage 15-30 sekunder at opdatere ressourcekalenderen"
Range("A5").Activate
Range("A5"). CurrentRegion.Select
'Set range
ActiveCell.Offset(Selection.Rows.Count, 0).Activate
LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row.....................

View 8 Replies View Related

Optimize Select Random Cell Value Without Duplicates Code

Apr 6, 2013

I have two worksheets. ws1 contains a large number of dates on column 3. ws3 contains around 20 dates on column 3.

I want to pick two dates randomly in ws1 that does not already exist in ws3.

Here is my working code, but it is really slow to process. How to optimize this code? Also I would like to add a function where if the macro is not able to find two random dates that aren't already in ws3 then exit loop.

VB:
Set ws1 = thisworkbook.sheets(1)
Set ws3 = thisworkbook.sheets(3)

lr = ws2.Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious).Row
Set rvis = ws2.Range("c2:c" & lr).SpecialCells(xlCellTypeVisible)
mynodate = 0

[Code] .....

View 7 Replies View Related

Optimize Slow Code And Avoid Copy To Clipboard?

Oct 7, 2013

this code to minimize it and avoid copy to clipboard.

VB:
Sub SapOutputRun()
Application.EnableEvents = False
Application.ScreenUpdating = False

[Code].....

View 2 Replies View Related

Finding Out Whether 4 Lengths Are Equivalent

Aug 18, 2009

I have 4 lengths in four columns in a random order, and need to compare them to see whether they are equal lengths.

I Have figured out how to order them so I can compare them, but can't think of a formula to show whether they are equivilent (eg 1000m = 1km) True or False outcome is fine.

View 3 Replies View Related

Sorting Columns Of Different Lengths

Oct 15, 2009

I have three columns, one column is time every two seconds with data associated that time, and one is time every minute with an associated tidal height.

I want to sort my data so that for every 2 seconds I have an associated tidal height for that minute.

eg:
what I have:
Time Time Tidal Height
(2 sec intervals) (min) (meters)
1:15:00 1:15 1.342
1:15:02 1:16 1.221
1:15:04 1:17 1.115
...
1:15:58 1:43 0.024
1:15:60 1:44 0.012
1:16:00 1:45 0.008 ....................

View 2 Replies View Related

Transpose Data Of Different Lengths

Aug 19, 2014

I have a performance extract from a system which has performance for multiple accounts but the data is off different lengths and shown vertically. I wish to move the data onto a new sheet but rotated(transposed) horizontally

Attached is a snapshot of the report that is usually about 20,000 lines. See input and output tabs.

Is there any way that a macro could be created to do this.

Performance.xlsx

View 3 Replies View Related

Varying Lengths Of Digits

Jan 16, 2006

My data is as follows, all in one cell:

10015200 US Government Bonds 18,369,423.52
10012301 US Government Bonds 10,232.21

There are many varying lengths of digits. I am trying split off the numbers
to the right of US Government Bonds into another column. Here is my
formula:
=RIGHT(A7,IF(ISERROR(FIND(" ",A7)),LEN(A7),FIND(" ",A7)))

My result is 9,423.52. Its not pulling the whole number.

What do I need to change in the formula?

View 14 Replies View Related

Formula For Columns Of Different Row Lengths

Feb 28, 2009

Say I am downloading a column of stock prices and it cannot be predicted precisely how many rows will be contained in each downloaded column.

The column is, however, always Column E.

Two formulas must be computed.

1) Last row with a price in column E / average (all rows, beginning with row 2 with prices in column E)

2) Last row with a price in column E / average (last 50 rows with prices in column E)

Can Excel manage the variable number of rows required for these formula, and if so, can somebody recommend how to write these formulae?

View 11 Replies View Related

Condition With Different String Lengths

Jan 3, 2008

Is there a formula out there that can check if a cell begins with 1 of a range of numbers of different lengths?

Example does A1 begin with A2, A3, A4, A5 where A2 = 123, A3 = 4567, C3 = 89.

View 9 Replies View Related

Calculate Facets Lengths And Radius

Dec 2, 2008

I have used ROW function to determine the facets lengths and the number of internal angles and also the radius's
the offset figure is the distance the track or pole is set from the frame this can be adjustable by us or the end user

the radius measurement is a minimum and a maximum that the aluminium can be bent, will probably
be set parametrs to work with

Now bay widows come in all sorts of shapes and sizes
90 degree angle bays
2 bend bays
3 bend bays this is why I am using the row function, once the measurments are entered can excel generate

View 12 Replies View Related

Find Average Of Different Wave Lengths

Aug 14, 2013

I have attached an excel file. What I would like to find is the average of column D (number) with respect to column A (Genotype ) and also different wave length (Column C). i.e.:

Genotype 1 to its corresponding value in column D for wave length 450
Genotype 1 to its corresponding value in column D and for Wave length 470 to and so on.

Attached File : test2.xlsx‎

View 6 Replies View Related

Comparing Two Columns Of Different Lengths With Names?

Feb 5, 2014

I'm trying to compare two columns of names that are different lengths. I need a formula that will return the differences. I've tried everything my nonanyltical mind can think of

View 5 Replies View Related

Sorting Numbers Of Varying Lengths

Aug 15, 2012

I am trying to do a VLOOKUP using a list based on our Part numbers in Excel 2007. When I do a normal sort it groups the numbers 1 thru 9 by the number of digits, giving me multiple list of 1 thru 9. When I do my lookup it will not find the shorter numbers. Is there some way to sort these Part numbers in order regardless of the number of digits?

View 2 Replies View Related

Copying Out Data Columns Of Different Lengths?

Jun 25, 2013

I am half way through writing a bigger macro, but am stuck at this stage.

I need to copy from a block of data as shown:

However, this column varies in length each time, and I only want to copy down to where the entries stop.

I also only want to copy W1:X6, and columns Y, AA, AB, AD (but only down to the end of the column)

I've tried using the End(xlDown)).Copy function, but obviously this doesn't work with the block up the top and the gap between the block and the columns

View 4 Replies View Related

Extract Varying Lengths Of Text

Jul 9, 2007

I have a column of data that contains suburb, state and postcode (zip code). I can extract the postcode quite easily using:

=RIGHT(H2,4)
However, sometimes there is one word for the suburb, and other times there are two or more words. Also, the state abbreviation contains either two or three letters:
MARYBOROUGH QLD 4650
BRAY PARK QLD 4500
TEA TREE GULLY SA 5091
Does anyone know of any code I could use to extract the three pieces of information into three new columns? (I.e. Suburb, State, Postcode)

I imagine the formula would contain some method of counting the number of paces; however, the number of spaces between each word may be more than one space.

View 9 Replies View Related

Autofill With Formula: Variable Lengths

Oct 3, 2007

need to autofill collum C with a formula related do collum B. If I do this by hand I just type the formula in C 1, and click on the right-down corner of the cell selection, and the formula goes until the last line (last value on collum B). But I want to create a macro to this function, and the problem is that the files that I will apply the macro have different lengths. I want to modify the macro to be able to run from C1 until the end of the values on collum B. I don't want to freeze the last value.

Here is the macro

Sub Macro3()

ActiveCell.FormulaR1C1 = "=60000/RC[-1]"
Range("C1").Select
Selection.AutoFill Destination:=Range("C1:C4819")
Range("C1:C4819").Select
Range("E7").Select

End Sub

In other files C4819 will not be the last value, could be 5345 for example, but its impossible to do this, my macro should do: "autofill collum C with a formula until the last value on collum B"

View 9 Replies View Related

Copy Data With Variable Row Lengths

Apr 18, 2007

I need to copy cells M6 to S6 down to all rows in a worksheet. The columns will remain M to S. The number of rows however vary in each worksheet.

How do I get the macro to read "End Down" with varying number of rows. I will need to do other functions also using "End Down" so if possible is there a generic code for this.

View 9 Replies View Related

Macro For Rows Of Varying Lengths

Jul 13, 2007

I paste in information in Columns A-E with varying lengths for each report that I need to generate (They generally range anywhere from 10-500 rows). I have formulas already in place in the first row of Columns F-L that need to be copied down as far as columns A-E go. I recorded a macro for this when I try to run the macro for another report with more or less row entries it copies down as far as the original recording was set. How do I make it so the rows will copy down just as many as I need and not some arbitrary number of rows? This is my first post so if any clarification is needed that's no problem.

View 3 Replies View Related

Function To Work For Barcodes Of Varying Lengths?

Aug 4, 2014

Goal: To extract the barcode (numbers and letters between B/C: and , P/G) from the following string:

"Codec B/C: A01234567, P/G: 123456728912345"
Current Function: =MID(A1,(FIND("B/C:",A1)+5),(FIND("P/G:",A1)-14))

Problem: I need this function to work for barcodes of varying lengths. For example, in some cases the barcode may be 8 characters long and at other times the barcode will be 14 characters long etc.Below is a screenshot of how I have this currently set up in excel.

View 7 Replies View Related

Extending Range Function To Account For Different Row Lengths?

Apr 25, 2014

VB recorder in Excel. The macro is designed to process a spreadsheet that will have the same number of columns and same type of data in each column, process this data with a formula (hat tip: AlKey+XOR LX) and then clean up the columns ready for use in another program.

I have got it working but when I alter the row length the macro only works to the final row in the recording spreadsheet. I realize this is because when recorded the macro I told VB to set the range to a given row.

I remember there is a way of setting the Range function that tells VB to always go to the bottom of the rows filled with data but I can't find it for the life of me.

see the attached file the training spreadsheet.

[Code] ......

DdSample_training_data.xlsx
process.docx‎

View 4 Replies View Related

Comparing The Lengths Of 2 Data Rows At A Time

Jun 12, 2009

Assume there's an even number of rows containing textual data.

COL A
text1
text2
text3
text4

I would like to compare the lengths of text1 to text2, and return the row containing the greater of the two/delete the row containing the shorter of the
two. In either case, the contents below would then have to be shifted up by one. Then repeat for the next 2 rows all the way down to the last row using VBA.

View 3 Replies View Related

Listbox Column Widths And Lengths -Autofit

Dec 9, 2009

I've got a Listbox in a User form that looks at data on another spreadsheet purely for informational purposes, not to be selected. I have two problems with what it's doing:

1) There are 23 columns, of varying widths. However the listbox uses a standard width, so some items are truncated and some have too much room.

2) The data changes, and the number of rows may change from 2 to 15000. I've set the RowSource to cover the ranged from A1:W15000, but if only 2-300 lines are selected the user can't grab the scrollbar button to scroll through, but must instead use the arrow, which is rather slow.

Is there any way to set the column widths to match the data, and the Range to only go as far as the last populated row?

View 7 Replies View Related

CONCATENATE Spacing Issue Due To String Lengths

Oct 17, 2008

if you look in Column G you will notice the number on the right side of the column is indented one space too many (for any number that is 6 long in column A).

Is there any way to do an IF C=6 and then have it remove a space from before the number in Column G to have it line up?

View 4 Replies View Related

Excel 2007 :: Summing Ranges Of Different Lengths?

Feb 6, 2012

I am working on this report for data from 2007 to 2011 for multiple customers. I have two columns of data for each customer for each year. My ultimate goal is to get a total for both columns of data and insert it in the row right under the row containing the last year of data. Below is a sample of what my data looks like and what I want it to look like. Here is the data:

2007113565200812642520091125452010136215200722519620082342352009212584201023656220
11225648200734323420083135572009315315201031826720074256852008442953200
7518816200853224520095314912010524676201153891320106518462011
62412520077155452008717696200973247520107521212011719343

I want it to look like this:

2007113565200812642520091125452010136215Total886150200722519620082342352009212584201023656220
11225648Total13393252007343234200831355720093153152010318267
Total90217320074256852008442953Total68513820075188162008532245200953149120105246762011538913
Total145924120106518462011624125Total7597120077155452008717696200973247520107521212011719343Total1369280

The only part of the coding I am having problems with is the sum function for the different lengths of data. Below is the code that I have so far.

Code:

Sub Report()
Dim i As Integer
i = 3

[Code]....

View 6 Replies View Related

Extracting Substring Text Of Varying Lengths

Dec 6, 2013

I have figured out certain formulas that can get me pieces of the text substring, I am having difficulty finding an all in one solution that will allow me to run a macro and automate this process due to the nature of variability of the # of characters in the text string. The category and what I need to extract is as follows (Michigan Missing Zips roll up I can deal with):

MWR - Illinois - HORIZONTAL LATHES
MWR - Illinois

MWR - Illinois - MACHINING CENTERS - HORIZONTAL & OTHER
MWR - Illinois

MWR - Illinois - MACHINING CENTERS - VERTICAL
MWR - Illinois

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

View 3 Replies View Related







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