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 large database of equipment on one sheet and an input form on another. For inventory control, when a user scans a number into the input form, the main inventory sheet is updated with the current location. I have it working using functions, but I need to do this in VBA. I am looking to do the following;
User enters 2222 on the input form. The code matches 2222 on the inventory sheet, moves the activecell 10 columns and updates a value in that cell. Cell A2343 is "2222" then Cell K2343 is changed to "WAREHOUSE 4". What is the best way to find the match and then select that cell in VBA?
I am having some trouble getting a formula to work. I am building a report that pulls figures from a pivot table in another workbook. I am using a vlookup with match function to get the column index to find the relevant data I want. Where I need to add two columns together I am using sum, with the vlookup & match formulas nested in them e.g.:
Where: F13 = Employee number Column C on the pivot 156 workbook is where the employee number is based. The Match formula is then getting the column index from the column headings of the pivot table ie. "FAID"
This in itself works fine, as long as it finds a match in the column headings. This is where i get the error as in the above function "COMD" is not in the pivot table. However I need to keep it included as it may appear on a future pivot table. Is there a way of getting the sum function to complete even though later in the formula it can't complete the vlookup? So it will ignore it, or assume the value is zero if it can't find it? The formula probably needs to do this for all the vlookups as some headings may drop off in future pivot tables.
I consider myself an ok Excel user and use it within a window of comfort for lots of things successfully, however todays task has me stumped and extremely frustrated... cant see the wood for the trees...
I have a spreadsheet of data collected from two sources, columns A & B from one source and columns C to E from another.
There are usernames in columns B and C.
I need to sort the entire sheet so that a username in column B is aligned with the same name in column C (and keeps the rest of the data in the row together)
I have scoured the net for hours for what seems such a simple operation to no avail.
Example:
A B C D E data username1 username1 data data data username2 username9 data data data username3 blank data data data username4 username6 data data data username5 username2 data data
I am looking for a macro to sort my colums in ascending order the range i need sorted is from A7:F107, it will be sorted with the numbers in the A column ie 1 - 107. sometimes different numbers get added and it has to be sorted in number sequence.
If possible i would also like a macro to protect this range after the sort,
I have a huge database. I am looking for a macro that can search for a particular word. If a match is found, the macro should do two things simultaneously... (i) delete the contents of the cell in which the match is found........(ii) display the same contents 1 row below and 1 coloumn to the left of this cell where the match is found. For e.g....
Column A has customer name, columns B,C,D has corresponding sales data for that month. Column E is blank. Column F has has customer name. Column G,H,I has the same corresponding sales data for the next month.
Although Column A and F both have customer names, there are many changes month over month with the addition and deletion of certain customers so the rows do not match up exactly. Is there a quick way to have the rows match up according to customer names in column A and F and then sort them alpabetically?
Currently my list looks like this: Jan Feb A A B C D D F E H F L G M H
I would like it to look like this: Jan Feb A A B C D D E F F G H H L M
Column A has donor name, column B has corresponding donation data for 2011. Column C has donor name, and column D has donation data for 2012. Column E has donor name, and column F has corresponding donation data for 2013.
Although Columns A and C and E all have donor names, there are many changes from year to year with the addition and deletion of certain donors so the rows do not match up exactly. Is there a quick way to have the rows match up according to donor names in column each of the three columns? Secondarily, I need to sort by donation amount from highest to lowest (it can either be the total over the three years or based on any single year.
Currently my list looks like this: 2011 2012 2013 A A A B C B D D C F E D H F I L G K M H M
I would like it to look like this: 2011 2012 2013 A A A B - B C C - - D- - E- F F F G G G H - - L - L - - M
Basically, I want to see the year over year giving for each donor. I've attached a sample for refrence. (I can't post the original due to confidentiality requirements.)
I have 3 columns of data and 30,000+ rows. Column A & B are related and column C contains some of the same values as column B but not an exact match. I'm looking for a way to sort columns A & B so that columns B & C match up and the data from column A is moved as well. For any data that has no match, a blank space should be input. Please see below.
A B C
red dog cat blue cat dog green mouse pig yellow horse kitten
A B C
blue cat cat red dog dog green mouse pig yellow horse kitten
I have a data entry sheet for attendance that shows the individuals name, date and hours attended. Each individual attendance is addedd to a new row. I need to transpose this data and display it in a report table, with the names in column A and showing hours worked for each day of that week. The formula needs to accomodate the growing data entry sheet as records are added (I'm using a date picker to change the week in the report sheet).
I've tried match, lookup and index and have confused myself thoroughly! Below is a sample of the data entry sheet (on left) and report table (on right)
******** ******************** ************************************************************************>Microsoft Excel - Book1___Running: 11.0 : OS = Windows XP (F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)boutH1I1J1K1L1M1= ABCDEFGHIJKLM1SurnameDateHours**Surname1-Jan2-Jan3-Jan4-Jan5-Jan6-Jan7-Jan2Smith1-Jan-076**Smith63600363Jones1-Jan-076**Jones66000304Rogers1-Jan-076**Rogers60600005Hathaway1-Jan-076**Hathaway60600006Pearson1-Jan-076**Pearson60000007Wills1-Jan-076**Wills60000008Smith2-Jan-073**********9Jones2-Jan-076**********10Smith3-Jan-076**********11Rogers3-Jan-076**********12Hathaway3-Jan-076**********13Smith6-Jan-073**********14Rogers6-Jan-073**********15Rogers7-Jan-076**********16Rogers8-Jan-076**********17Rogers5-Feb-076**********18Smith6-Feb-076**********19Jones6-Feb-076**********20Rogers
Dim c, DataRow With Data Set c = . Range("A5:A350"). Find(KPI, LookIn:=xlValues) If Not c Is Nothing Then DataRow = c.Row End If End With
Now,If KPI is for example = "Favourite Hotel" and if i have data that looks like :
Favourite Hotel - London Favourite Hotel - Cardiff Favourite Hotel Favourite Hotel - Birmingham
Then it seems to not look be looking for an exact match (e.g. Favourite Hotel) and rather is finding the first item in the list that contains the KPI string (E.g. Favourite Hotel - London).
I have a WB with multiple sheets. I have a Feed sheet that automatically pulls data from the web. I have a Scores sheet that currently has all head to head matchups each week for an entire season. So I want to check the cells on the Feed! sheet to find a partial match and if partial match exists then copy cell that contents score from feed sheet to the score sheet next to the appropriate teams name. Currently I have to manually enter all scores each week for the rest of my WB to update.
I need to look at Cell A3 (on the Feed sheet) which has "New York Jets" then search for a partial/similar match on the score Sheet (which is NY JETS, in this case). NY JETS could be in column B (rangeB2:B257) OR column D (rangeD2:D257) BUT I need to search by row, not column, then once a match is found check the cell to the immediate right and only if the cell is blank copy data from the (!feed) sheet to that blank cell on the (!scores) sheet
This is what happens if working right =
look at cell A3 on the (!feed) sheet = "New York Jets" then search (!scores) sheet Column B and Column D by row for a partial match, finds "NY JETS" as match in cell D8, if cell E8 is blank then copies cell H3 from (!feed) sheet, and pastes to cell E8 on the (!scores) sheet, if cell is not blank continues search until 1st blank cell to the right of matching cell is found (as there will be mutiple matching cells with blank cells to the right but I am only interested in the 1st blank cell found, once found and data copied the process is done and then starts over with cell A4)
Look at cell A4 (!feed)= "New England Patriots" then search (!scores) sheet Column B and Column D by row, finds "NEW ENGLAND" as match in cell B8, if cell C8 is blank then copies cell H4 (!feed) sheet, and paste to cell C8 (!scores)
Once this is done it moves on to the next cell in the next row on the (!feed) sheet, A5, to find a partial match for the data in that cell. I need to continue the search for each cell A3 to A74, and if no match is found to move on to the next cell A6... (based on the way the data is pulled in from the web there are some blank cells as well as some cells that say Game Final, this data won't be on the scores sheets in column B or D).
I would like to find a value w/i a column after sorting and insert a row right above it. After that I would like to sort again from that point downward.
I'm looking for is something that searches all worksheets in the work book for occurances of A1 (shovel) and replace it with A2 (spades). The list will be about 100 cells long and the idea would be that I could copy a sheet called "replace" with this list in, run it and standardise all the terms in the list within that workbook. Does it sound feasable?
The other query I'm not sure can be done. When I've tidied all these 'names' to a standard one, I want to sort the data (sometimes rows, sometimes columns) alphabeticalled for instance by the A1 to A10, or by A1 to Z1. Simply using the sort option loses all the references as is doesnt change any cells linked to that cell. The only way I could think to make keep the other cells pointing to where they should is to cut and paste/each row/column in alphabetical order manually.
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 am making a spreadsheet that sorts and pastes, but I need to know if I can add a code to the Sort and Paste Macro that will open the second spread sheet needed without just already having it open and using the
I have a lot of data to filter / sort. I want to initially to create a filter for a column of data - which has the format similar to hierarchical paths to files. The data is a mix of text/numbers. e.g.
Doing an alphabetical sort of this date would return the following order. As you can see while each strings in unique - there are many instances where they are simialr - if you ignore the unique numeric values at the end of the string.
So what I want to do is to create a filter for the strings - but ignoring the numeric bits at the end i.e.
reg_[0-9]+_+[0-9]+/d
The strings are obviiously of varying length and the number of hierarchical paths is different, so I can't split string on "/".
Similarly folder paths names can contain "_" so can't split string on this either.
As I don't know how many "/" or "-" instances there will be in the string I don't believe I can use the find function. Also as the amount of number will be different i don't think I can use =right(a1,X) either.
I may be able to search for the pattern above - as this is probabay unique - so maybe it's something like the following pseudo code:
Function GetString(txt As String) As String With CreateObject("VBScript.RegExp") .Pattern = "reg_d+(_)+d+//d" GetString = .execute(txt)(0) End With End Function
If I do require VBA code - how do I then use this for creating a column filter? Or will I have to extract the filtered data first from the column (and its associated row data) into another worksheet to use?
Once I have the filter in place I want to create tables using the filtered data - so for example each column value above has a lot of associated data values in each row e.g
I have been building a tracker to track benefit payments for child benefits and DLA so I know where I stand and what has been paid.
The problem... its limited and basic an I have to do most things manually, even when I have cell formulas to do some of the legwork.
I stumbled across the term MATCH and SEARCH and I was curious on how to use them for my needs, I was trying to use the LOOKUP set of tools.
My problem...
Benefit rates are set between two date periods, all payment periods are 28 days apart (...but could change to every 7 days) which means that sometimes payments are due 3 weeks of one rate, 1 week of another, the reverse of that or 50:50 depending on the cycle.
A B C
[Code]....
The problem should be very evident and especially when I adjust the dates to match what payment dates I finally end up with.
The result of the look up needs to be calculated at the frequency in A14 to B14, A15 to B15 (for example) at the appropriate rate found in D:D when searched for based on the dates in A14 to B14 ... ... etc.
I tried using MATCH to get a match to a date falling between 30/12/2013 and 4/4/2014, I tried this...
I have a workbook with two sheets, one used for referance (Column A - Product SKUS, B - Product Description and C - Carton Quantities) - Sheet 1
The other sheet I would like to import incoming shipments. (Column A - Product SKUS, B - Product Description, C - Quantity Ordered and D - No of Cartons) - Sheet 2
What I need to do is find out how to get Excel to find and match up the SKUs in Col A and then dividing Sheet 2's column C by Sheet 1's column C to give the number of incoming cartons of each product in Sheet 2's Column D
It works until I exceed the MATCH character limit of 255 characters in the range with text. I have tried many alternate formulae found on various posts, but not one that suits my purpose. Is there a simple ISTEXT or another function/formula that will work here?
I've got a sheet here with a master list of document numbers in Column A and a smaller subset in column C. I need to do is for Excel to scan column A for cell C1 and when it finds it in column A i need it to return the corresponding value in B column into cell D1. I need to do this for all column C.
In Sheet 2 i have a 1000 of data contains the birth date of following customers
The result i want in Sheet 1 is particular on todays (Say on 27-11-2008) date how many customer are having birthday, supoose there 10, or 8 wahtever should show me the list.
I tried this formula
=INDEX(Sheet2!$B:B,MATCH($B$3,Sheet2!$H:$H,0))
but by this formula it only show one customers birthdate what i want if there 10 differenrt customer those same birthdate it should display all the 10 date and name in diff rows
I have a sheet with dates on it, when i open my userform and select a date i want it to go to the sheet and look for a match on the date and select the cell where the match is. There will never be 2 dates that's the same. I have attached an example.
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.