Nearest Neighbour Algorithm With Vba
Feb 5, 2008
I am trying to solve the nearest neighbour algorithm with vba
For example, I have a table as the following
0 1 2 3 4 5 1
10
5
15
20
2 10
8
9
7
3 5...........
View 9 Replies
ADVERTISEMENT
Jan 28, 2009
This just a shot in the dark, but does anyone have a custom function that calculates the check digit for a cusip? http://en.wikipedia.org/wiki/CUSIP
The algorithm is listed above.
View 3 Replies
View Related
Sep 25, 2009
Have an excel table with following data:
- ID
- number of bottles
- number of bottle crates (there are 20 bottles in one one bottle crate)
201688194000bottles
20168819200crates
2016883812000bottles
20168838600crates
201688396400bottles
20168839320crates
201688809000bottles
20168880600bottles
20168880480crates...................
I need to write a macro which will do this operation for each ID:
(bottles/20)-crates = x
and if "x" is not 0 then write down the value of "x".
There are two points I would like to point out:
- One ID may contain 3 or more rows (see 20168880)
- The macro will work with hundreds IDs so the algorithm should be fast (but it is not necessary)
View 3 Replies
View Related
Dec 4, 2007
Anyone have an excel sheet that automatically generates secret santa selections?
Or explain an algorithm so I can implement it on excel?
View 9 Replies
View Related
Apr 8, 2008
I wonder could anyone help me with a problem i'm having, I have a table showing a basic RSA algorithm in excel, for example,
M 13 2197 19 8893887173 13 M
N 14 2744 5 788125 14 N
etc etc,
How the numbers are derived isn't important, what i want to do is create a visual basic form, to allow a user to input a letter, for example M in a text box, click a button, and then the 5 related digits are shown.
So the user inputs M into a text box clicks a button, then 13, 2197, 19, 8893887173 and 13 is output to 5 other text boxes.
View 9 Replies
View Related
May 30, 2006
Given a list of numbers and a list of 'allowable' operators, come up with a specific total. ("The numbers game" on countdown on BBC2.... ooooh Carol Voderman)
For example, given the numbers 1, 3, 4 and 5 with valid operators +, -, /, * come up with a solution equal to 15. All numbers must be used once only. Use operators as often as required. The specific example above was given to me and I personally think its not solvable (might be a practical joke). But I am wondering is it possible to prove this through assertions or develop an algorithm to solve such puzzles. I can get 14 and 16, but not 15....
View 8 Replies
View Related
Jun 4, 2007
Im looking for an algorithm to sort an array of data, deleting multiple values whithin the array and shifting the values down the array to leave no gaps. the crude set of loops i am currently using is:
For f = 0 To 100
For g = f + 1 To 100
If LineArray(g) = LineArray(f) Then LineArray(g) = ""
Next g
Next f
which does work and serves my purpose but is messy as it leaves blank gaps in the array.
View 2 Replies
View Related
Dec 2, 2009
I have this module that is supposed to look in column A and if it sees duplicates it looks in column B (with the date) and erases the entire row where the date is older in column B. I am attaching a sample to better illustrate it.
The highlighted in yellow rows are were I have duplicates and I want the row where the date is in red border to remain.
The module I have so far erases the newer records instead of the older.
This is the file:
Sample sorting.xls
Here is the
View 3 Replies
View Related
Jul 7, 2009
i'm working on floyd algorithm macro for a project,
problem is, the spreadsheet matrix is huge, it's a 1043 x 1043 spreadsheet
And this is taking wayyy too long, i've been waiting for almost 2 days already..
here's the file :
http://ifile.it/6v2j39f
(You start the macro using "run" command in "input" sheet)
So is there any way to speed it up?
Or if anyone got a supercomputer, could you help me process this? :p
I'm thinking about changing the 10^5 value into infinite value, but i can't find a way to display infinite value..
And here's some reference for Floyd's algorithm,
http://ifile.it/12p5zle
I have tried to split the algorithm to make it process one iteration at a time, but i've been waiting like 2 hours with no result,
and that's for 1 iteration, can't imagine how long it takes for 1043 iterations
You can do this by deleting the.
View 14 Replies
View Related
Feb 17, 2012
I have a database of approximately 250000 email addresses and I would like to see if there is some way to use Excel to analyse the strings in order to identify potential 'non-unique' individuals.
For example, if I have the following email addresses:
12345@example.com
12346@example.com
12347@example.com
or
example1@example.com
example2@example.com
etc
Is there some way of extracting common text strings, lets say where there is a difference of 1 character / digit between strings (rather than alphabetising and searching manually)?
View 2 Replies
View Related
Aug 8, 2009
I want to display the path result from a Floyd Algorithm matrix output..
You can download the excel file here : http://ifile.it/lw4tgic
It consists of 1044 nodes, and we need to find the path between 2 nodes for ALL pairs..
Now, to find the path between 2 nodes, we need to :
1. Find the resulting cell of corresponding 2 nodes (y to x = z)
2. Update the path with that value (y z x)
3. For all the direct pairs in the current path (yz, zx), find the resulting cell
4. If destination (x) not the same with result (z) then repeat step 1 for that pairs.
5. repeat until x = z for all pairs.
Maybe it's better if i use an example....
we'll use T01 to E78 as an example
T01-E78 = if you look in the table,
y (vertical) = T01,
x (horizontal) = E78
z (result) = E77, so
T01-E78 = E77, so path = T01-E77-E78
check if result of T01-E77 = E77 (x = z?)...........................
View 10 Replies
View Related
Apr 4, 2014
I have a form to round to nearest quarter but if it is less than 1 hour I need it to round to a total of 1. Can this be combined in one formula.
I also need my time to be configured so that if the start time is a PM number then end time AM it does not figure right. is there a way to remove the AM/PM from time. I have already tried all the formats from number,time, & custom.
Attached is my form : Timesheet Form 2014.xlsx
View 4 Replies
View Related
Feb 20, 2009
I am using the rounding function in excel and its rounding to the 10's, is there a way to round to the nearest 5?
View 4 Replies
View Related
Apr 29, 2013
I need a formula that will roundup the amount in a cell to the nearest 50 (as in 246 £ will become 250 £)
View 4 Replies
View Related
Feb 6, 2010
Below is my current formula. Right now I have it rounding the results to the nearest .09. I would also like to have it round to the nearest .05 as well.
In other words, to be more exact: I need all numbers that end in 0 or 1 to be rounded down to 9; any numbers that end in 7 or 8 to be rounded up to 9; any numbers that end in 2, 3, or 4 to be rounded up to 5; and 6 to be rounded down to 5. And, of course any numbers ending in 5 or 9 shouldn't change.
View 14 Replies
View Related
May 23, 2012
I am using the MROUND function and it will round up or down to the nearest whole 50. Is there a function to round only UP to the nearest whole 50?
ie: 1704 is being rounded to 1700 I need 1704 to rounded to 1750
View 3 Replies
View Related
Mar 11, 2009
I have excel 2003. I'm working on a weight lifting program and need to have cells round to the nearest 0 or 5. My problem is that the cells I need to round already have a formula in them and I can't get the cell to round the answer of the formula.
D17=U4*.6
I need the answer to be rounded to the nearest 0 or 5.
View 9 Replies
View Related
Nov 2, 2006
I wish to apply a rounding rule that will correctly round up or down to the nearest 5 or 0.
I tried using ceiling and floor and am almost there, but not quite.
Rule is to round up or down to nearest 5 or 0
originalplancfcheckroundedrulewill use
634should be 630635630f634
634.4should be 630635630f6343f
634.5should be 635635630c6352c
634.6should be 635635630c6352c
635should be 635635635c Or f6351f
635.1should be 635640635f6351f
635.5should be 640640635c6364c ...............
View 9 Replies
View Related
Jun 9, 2007
I trying to make a formula that will multiply a cell by 1.43 and then round the total up to the nearest 45 or 95 with no decimal points.
View 9 Replies
View Related
Jun 28, 2012
I have downloaded a punch in time clock from another user " Alex17", great job by the way. I was wondering on how to apply some certain rules this. I would need the times to round to the nearest quarter. Let's say someone punched in @8:01AM or any time up to 8:07AM, I would need it to round to 8:00AM, if they punched in from 8:08AM up to anytime to 8:14Am, I would need that to round to 8:15AM or if someone punched in @ 8:23AM it would round to 8:30AM....etc. I attached the form.
I need these rules to apply
7:00 - 7:07 round down to 7
7:08 - 7:15 round up to 7:15
7:16 - 7:22 round down to 7:15
7:23 - 7:30 round up to 7:30
7:31 - 7:37 round down to 7:30
7:38 - 7:45 round up to 7:45
7:46 - 7:52 round down to 7:45
7:53 - 8:00 round up to 8
or if this makes more sense
7:00 - 7:07 round down to 7
7:08 - 7:15 round up to 7.25
7:16 - 7:22 round down to 7.25
7:23 - 7:30 round up to 7.5
7:31 - 7:37 round down to 7.5
7:38 - 7:45 round up to 7.75
7:46 - 7:52 round down to 7.75
7:53 - 8:00 round up to 8
View 4 Replies
View Related
Dec 12, 2013
I am looking for a formula which will allow a value to round up or down to the nearest x.99 if the value is greater than x.95 or less x.05 otherwise remain the same. i.e if the value is 0.96 it should read 0.99 and if the value is 1.04 it should read 0.99. however if the value 1.05 it should read 1.05.
View 9 Replies
View Related
Jan 30, 2014
was given only looked at the nearest date and not the nearest date after.
So here goes; I have a table that looks at new starters and the date they started, and then a list of dates appointments offered (these dates can and often do precede to person joining us).
What I'm looking for the first chronological date AFTER the New start Date.
In row 3 this works; as it is the nearest date, but in row 4 however, it is the nearest date; but occurs before the New start Date, thus is incorrect.
View 2 Replies
View Related
May 18, 2009
If I have a date that is 12 February 2008 I need to pick up data next to 31 January 2008 as that is nearest, however if my date is >15th February 2008 I want to pick up the data in the column next to 29 February 2008......
View 2 Replies
View Related
Feb 18, 2013
I need to round numbers up in a spreadsheet to the nearest .05 . For example, I would need to change 1.502 to 1.55 or 1.556 to 1.60 .
View 3 Replies
View Related
Sep 18, 2009
I write up job cards that require measurements in fraction form. Usually whenever i want to round off a figure , say 10/16, to 5/8, i right click on the figure and format cell it. However, this can be quite time consuming if there are multiple cells and are of a different breakdown.
What i would like to know if there's a shortcut way where when the 10/16 is in the cell, it automatically rounds off to the nearest fraction.
View 9 Replies
View Related
Oct 30, 2009
I'm trying to round some figures UP to the nearest .5, However i only know this formula: =MROUND(P2,0.5) and that rounds to the nearest .5? Is there anything i can use instead to make sure it is always up not down. so 6.13 becomes 6.50 or 7.53 become 8.00? etc.
View 2 Replies
View Related
Dec 17, 2009
I have a list in column A that goes [Blue,0,0,0,Green,0,0,Orange,0,0,0,0,0, etc.] The number of 0s is not in any pattern. Based on column A, I would like column B to go [Blue, Blue, Blue, Blue, Green, Green, Green, Orange, Orange, Orange, Orange, Orange, Orange,etc.].
So, I would like column B to look at column A, and if it is a 0, return the nearest color above. I was thinking of maybe using a whole bunch of imbedded "if" functions that would keep going up and up if it was 0 and then return the cell when it's not 0, but sometimes it might be 30 0s, so I'm not sure that's the most efficient way to go about it (or maybe it is and I'm not thinking about it right). Does anyone know a nice neat little function that would work? I've attached a sample spreadsheet that illustrates what I'm trying to do. Column A is what I start with and Column C is where I'd like to be.
View 2 Replies
View Related
Oct 16, 2007
How do I round $452.57 in cell A1 to $453.00? I want to format the cells to round to the nearest dollar and leave the .00 cents.
View 9 Replies
View Related
Dec 3, 2007
How do I format the date to be to the nearest work day?
I want to establish a due date for an asset that is due 5 days before launch. If my launch date is in A1, and my due date is in A2, in A2 I put:
=A1-5
So how do I make sure that the resulting date is a workday?
View 9 Replies
View Related
Dec 31, 2007
In cell A1, I might have the following numbers: 1, 5, 10, 50, 100.
In cell B1, I will have an unknown number
In cell C1, I want to round the number in B1 using the information given in A1.
For example:
A1 = 1
B1 = 153.45
C1 should be 153
C1 = round(B1,0)
A1 = 5
B1 = 153.45
C1 should be 155
C1 = round(B1,0) +/- 5 (depending on the situation)
A1 = 10
B1 = 153.45
C1 should be 150
C1 = round(B1,-1)
A1 = 50
B1 = 153.45
C1 should be 150
C1 = round(B1,-1) +/- 50 (depending on the situation)
Is there a quick of doing this using VB? I can do a bunch of if then statements... but was wondering if there's an easier way.
View 9 Replies
View Related