Find Two Closest Values In A List (bigger And Smaller)
Apr 9, 2014
I have a list with random ordered numbers (each number in a cell of a row): 1, 2, 6, 8, 11, 12, 16...
On the other hand I get a value (x). I want a formula that:
- If x is in the list, returns x
- If x is not in the list, returns the next higher value. For example, if x=8, returns 11
I want also a variation of the same formula, that returns the next lower value. For example, if x=8, returns 6.
Note that x will never be smaller than the first number on the list or higher than the highest number in the list.
The jist of the problem is that employees are paid their normal wage up untill 37.5 hours of work. From 37.5 to 40 hours of work they are paid 1.5 times their wage. Any hours over 40 are paid at 2 times the regular wage.
So i need a formula that can work out their total pay. Im not sure what i could put in a dummy document to help you since it would just be one cell for their hourly wage, one for their hours worked and then one for the calculation. so you can reference any cell as an example and assume £6 as hourly rate
i found this example of a combobox at http://msdn.microsoft.com/en-us/library/ms996411.aspx. but I don't think it is for excel. Is there anyway I can use code to make it so my combobox's list will be like the picture so it shows all the words instead of cutting them off?'
I have some spreadsheets containing substantial rows of data, basically 3 columns as this:
Sample Start End Difference (End-Start)
A 1500 1600 100
[Code] ......
And what i want to obtain is different rows of data such as every row has the same difference (20 in this case, without changing the first column), like the following (never mind the colors, they are only to make my point clear):
Sample Start End Difference (End-Start)
A 1500 1520 20
[Code] ........
We can also think about splitting only one certain number into 20's, like in the case of samples B and C above, because I have already split the data into separate sheets based on their "difference" value, using link:
Copy to new worksheets. Do you think it is doable?
I have a table of data, one column is for the names of all these branches of our offices, that consist of 2 alpha numeric digits. For instance one branch is 6G, then another is 6F, 8G, etc. The other column has a raw number in it. So I'm doing a vlookup for the first column to return the value in the second column. But, vlookup automatically returns a value thats the next one over if it can't find the vlookup value. For instance, if it can't find 6G it'll just give me the number it finds for 6F. But I don't need that! I just want it to return either a zero or n/a if it can't find 6G.
I am working on payment/cost estimator and am looking for some ideas and formula or macro help. Basically what I am trying to do is set up a calculator where you would input the payment you could afford and it will tell you how much you can spend on the equipment. The problems I am running into are that when you factor in the interest rate and commission, the payments are round numbers so I need the formula to find the closest value. Example- $250 payment. The payments in the table w/ the interest rates are $158, $248 and $350. I would need it to pick the corresponding equipment cost for the $248 payment.
Make sense? If a macro would be easier I am fine with that, just have limited experience setting one up.
I need to find which number in a row would be closest to zero, then display the associated name. The number can be negative. I used this, which works well if all the numbers are positive: =INDEX($C$1:$E$1,MATCH(MIN(C66:E66),C66:E66,0)). I'm running into a problem when the closest number is negative.
In the attached sheet, I am using !Staff times columns N and O to nominate a mid point break time relevant to the start,lunch break and finish times of a shift.
What I would like to do is match the result to the closest time from !Race Times Column D (highlighted green). So if for example the mid point of the shift is 10:37 (as in !Staff Times cell N23), it actually comes back with the !Race Times result of 10:35 which is the closest actual race.
Ideally I would like it to look both sides of the midpoint time until it came to the closest match, rather than always looking at an earlier time, or always a later time (eg the cell N79 has a value of 11:36, however the 2 race times are 11:35 and 11:40. Preference is it shows 11:35). If however the N79 result was 11:38 or 11:39, I would prefer it went to 11:40).
However if this is not possible then picking the next time in either direction will do.
Say i had a col of random numbers, and their corresponding probabilities of occurring;
-32.33 0.001497
-35 0.001523
-32.06876 0.001551
-29 0.001579
10 0.001607
7 0.001636
-31.54628 0.001665
-18 0.001695
Neglect the nature of the sample, its just gibberish and not of concern here. The question is, if i enter a value in column C, how do i find the closest corresponding number to it in col A, and subsequently return its nearest corresponding probability from col B? For example, say i entered 8 in C1, then the formula would need to find the closest number to 8 in col A, which is 7, and return from col B the value of 0.001636.
I've been turning this problem over it my head for the last day and can't seem to come up with a decent solution, so I figured I'd post it here to see if anybody else had any bright ideas.
I have a data sheet with a dropdown list on it to select the month and year that determines how the rest of the data sheet populates. Basically I'm giving weekly breakdowns of data for a month at a time, with the "Week Ending" heading (which are dates - Saturdays), populating off of the month and year selected from the dropdown.
So, to give an example, if somebody selects March 2008 in the dropdown, it will populate the week ending dates of 3/1, 3/8, 3/15, 3/22, 3/29, and then pull out the specific data for each week based on those dates.
What I'd like to do is write a formula that will find the first Saturday of the month. The way I have it jury-rigged right now is a list of months with the first Saturday listed next to it and a vlookup to grab the date of the first Saturday. I envision using this report indefinitely into the future and I'd like to avoid having to keep adding/changing the manual list of Saturdays, instead preferring to have a way to determine the date.
I have a list of Y-intercepts (Column B - highlighted in Yellow) and I'd like to sort it based on a certain value (in J4) and get the 10 closest numbers above that value and the 10 closest values below that value followed by the remaining numbers.
I have a list with all our company cars (300). I also have a list with all the transactions of the fuel cards (12000 lines). Now I need the find for every company car (exact match) the nearest fuel-consumption-date (closest match to the given starting date) and take the mileage of that transaction. I've added an example. I have tried linking carnr and date (like carnr&"#"&date) and match these, but I don't always get the right car number.
I cells B5:B15 I have a list of dates from last year. I need a formula that I can put in cell D5 that gives me the date that is closest to the same day last year.
Example:
If today is 4/9/14
and
From B5:B15 there were the following dates: 3/12/13 3/19/13 3/29/13 4/5/13 4/8/13 4/12/13 5/6/13 5/29/13
Cell D5 would contain
4/8/13 since it is the date closet to same day last year.
I needed to know how to find the closest match to a reference number regardless of whether its larger or smaller. I did a search and found a post back in March that said to use the following:
I applied it to my application and it works, I just have no idea why. Can anyone explain this formula to me or tell me where I can find a good resource.
I have a database where I have groups defined. For example, Parent 0001 is called Bag1. It contains an apple, orange, grape, and a pear. Parent 0002 is called Bag2, containing an apple, orange, and a peach. So on and so on...
Below is an illustration of what I explained above:
I need a way to input items that are in the groups and find the groups have all of the items or the group with the best match. I need to know if the match is 100% or if it is only a partial match.
The bag might have 2 items or it could have 20 items and they can be in any order.
I have modified some code I found in these forums that once I enter a value in a cell I can have it find the closest match to that value and scroll down the list and paste that value as an offset. The code works perfectly, but my data will often contain the same values repeated and these aren't duplicates and I need to know how to loop the code to ensure it doesn't just find the first value but also the second (if the first is already populated) Code is:
Sub findclose() Dim rng As Range, Dn As Range, Mx As Single, oAd As String Dim num As Range
Set num = ActiveSheet.Range("B1")
[Code] .......
---- What I need to do is insert a loop of some sort that basically says IF my offset cell has a value then to find the next closest amount and continue the macro.
So if my list was:
700 50 500 600 500
And I wanted to find 499 then my list would look like:
700 50 500 499 600 500
BUT if I wanted to match off another amount of 501 it would keep the 499 it found and then find the 501 making the completed list look like:
700 50 500 499 600 500 501
Right now the amounts are being overidden as I don't know how to loop it...
I have a sheet of pump test results, placed in rows, where the test rig is set at a specific speeds and flow and it records pressure. At each stage of the test a number of snapshots will be taken (Usually between 3-5 at each stage), so I have 3-5 rows of very similar data. I only need to use the best row from the selection available, so I am hoping to find a formula or code (Don't care which) that can look at the results and select the row of readings where the speed AND the flow are closest to the targetted data.
For example: In cells G6:G8 I have flow result values 0.129, 0.151, 0.156 and in H6:H8 I have speed result values 72.536, 71.82, 72.13. These are actuals. In cell N6 I have the target speed (75) and in O6 I have flow target (0.15), but these could be moved anywhere to suit really. What I was hoping to do, but am struggling big time, was to just flag up the row of readings where these two values are closest to the targets by placing a check mark in column L:L which I have formatted in monotype sorts and would like to place a "4" (Which gives me a check mark) on the 'best' row. From that I can do more with some simple IF statements.
Is this feasible, or am I trying to do something beyond Excels capability, it is certainly beyond mine at the moment. I was looking at the check mark method, but that is not essential, so if anyone has any suggestions on an alternative means of identifying the best row of data, that might make it easier to do, then I am listening.
I'm looking for a way to split a cell with text into two cells. The first cell can only contain up to 40 characters, the rest needs to go in the second cell. However, I don't want the text to be split in the middle of a word. So basically, if the text is in cell A1, I need to find the closest space to the left of position 40 in A1, and move anything to the right of this position to B1. Example:
Original text: A1: One green apple and a bucket of small onions that smell nice
I want to avoid this: A1: One green apple and a bucket of small on B1: ions that smell nice
I want to achieve this: A1: One green apple and a bucket of small B1: onions that smell nice
I am trying to find the cell in the named row "Ann_TaylorRegularBust" that is closest to the input bust size in cell B4. This formula works when I use actual range instead of the named array.
I have Excel 2010 & Window 7. I have 2 sheets of business names, some businesses in sheet 1 may be named slightly different in sheet 2 and not all businesses in sheet 1 are included in sheet 2. I would like to be able to find the closest match (from sheet 2) for the businesses on sheet 1 and return the closest matched business name.
Close Price Close Price Date s1s2s3s4r1r2r3r4 2.25 12/11/09 2.30 12/12/09 2.40 12/13/09 2.00 12/14/09 2.12 12/15/09 2.50 12/16/09 2.51 12/17/09 2.53 12/18/09 2.49 12/19/09
What I'm attempting to do is find what are the CLOSEST four indicator prices in data set #1 are above (r1, r2, r3, r4) and below (s1, s2, s3, s4) the closing price in data set #2. Also, I can only use the indicator numbers in data set #1 that are on or before the close price date in data set #2. Because of this, not all of the r's and s's will be filled in.
I would like to use just regular excel formulas, but I have a feeling that VBA may be my only option.
I have the following table of stocks with corproate action types and dates with a ticker / identifier per stocA1:
Type B1: ID C1: Date
[Code]....
I am trying to find the NEXT Dividendcorporate action that is CLOSEST to the current date. I've done some google trawling and found a few formulae that seem to work only if the identifiers or dates are in a particular order. ALso having trouble using TWO criteria
I have 2 different sets of data: temperature data recorded at meteo-stations defined by latitude / longitude, and major world cities also defined by latitude / longitude.
After the user chooses the station's coordinates, temperature data is pulled out from the first data set; this works! However, I would like to be able to provide information about the closest city to the chosen meteo-station from the second data set.
I Want To Add A Function To A Worksheet That Allows A User To Type A Word And It To Return Matches And Their Corresponding Number In A Different Column. For Example If A User Types In "new" In Cell A1 I Would Like For The Sheet To Return "new Deal" "1"; "new Order" "2"; "new Meal" "3"; And So One Until All Values Of "new" Are Returned. I Would Like These To Be Reutrned In A Pop Up Window If Possible.
I need to generate a form letter from values on another sheet. I'm using vlookup and as you know, for duplicate values, only the first reference is given. I have several duplicates and need to pull the correct row data for each instance. I would need to replace each vlookup with the proper formula in my letter.