Assigning Value By Performing Search Relative To Position
Jan 19, 2012
The data is a copy of CSV file in to a spreadsheet. Below is what the paste looks like:
100100 Books
1234.ab
1345.bf
1456
1567
100100 Books
100200 Magazines
100300 Videos
1234.ab
1345.bf
1456
1567
100300 Videos
All of the numbers between the 100100 Books, 100300 Videos belongs to that category. This repeats hundreds of rows down. I need the column to the left of this range to display which division it under. I parse this in excel so Books, Videos, Magazines will be in their own column. I am not exporting the CSV so have to manipulate it in excel. I need to have the column to the left combine the whole identifier so I can perform a VLOOKUP on it. It should look as follows:
100100.1234.ab
100100.1345.bf
etc.
My approach was to get the column to the left of the range to display the correct division, then have another column combine by using (cell)&"."&(cell).
View 1 Replies
ADVERTISEMENT
May 19, 2014
This one is a two parter. Part I is a bit of a necessity and Part II is a nice to have that would save me a boatload of time.
Part I: I need to assign a macro to a specific object in a cell. I've seen the code for targeting a static cell, but my data can be filtered and sorted.
For example, I have a cell in I6 that has text "Partial Deployment" that I want to run a macro on. If I were to sort alphbetically, this cell could end up as I20.
How to assign a macro to the text inside the cell? Also the text is not unique.
Part II: I would like to write a macro using relative referencing for similar to the below:
When user clicks on said object from Part I, the macro reads the corresponding column in that same row and users that to filter data on a separate spreadsheet.
Example: User selects "Partial Deployment" in cell I6, the macro references cell E6, copies the number "191", and uses that number to filter data on a separate spreadsheet.
View 4 Replies
View Related
May 16, 2014
I am trying to hide a column titled "Test". This column is usually column E, but it is possible it can be moved to column D or F. If I use:
[Code] .........
Then column E is hidden, regardless of whether Test is moved left or right. The reason Test moves is due to the user inserting or deleting a column.
View 5 Replies
View Related
Apr 2, 2007
I am trying to create a form with a text box that when text is entered, it adds to the userform another textbox with that data in it. The focus then goes back to the original textbox so that more may be added indefinitely, all with relative position to the most recently added textbox. Here is what I have so far, works for one time, but not multiple textboxes. The original textbox is "txtAPID"
Private Sub MakeNewTextBox()
Dim newTextBox As TextBox
Dim ControlTop As Long
With LastAirport
ControlTop = 30
End With
Set newTextBox = Me.Controls.Add("Forms.TextBox.1", "txtNextAirport", True)
With newTextBox
.Left = 20
.Top = ControlTop + 3
.Height = 15
.Text = txtAPID.Text
End With....................
View 2 Replies
View Related
Aug 1, 2008
I've got a list of story titles that are organized by genre, and I'd ultimately like to have a formula (not VBA) that automatically generates a "story id" based on the title's position within the genre (not the list overall). Here's a snippet of the list:
CREATE TABLES LIKE BELOW?IDGenreTitle
1.1GeneralTitle 1
1.2GeneralTitle 2
2.1Horror / SupernaturalTitle 3
2.2Horror / SupernaturalTitle 4
3.1Sci-FiTitle 5
3.2Sci-FiTitle 6
So what I'm looking for here is the formula that would give me the ID shown in the first column (I can modify it later for specific purposes). I've tried variations on the MATCH, INDEX, ROW, and VLOOKUP functions but just can't seem to get it quite right. Note: All the items in the Title column are unique - there are no duplicates.
View 3 Replies
View Related
Jul 14, 2014
I need to insert a picture on a Excel 2010 worksheet.
The worksheet contains a variable number of columns, and the column width is also variable.
The picture needs to be aligned such that the right edge of the picture is in line with the right side of the last used column.
This is so that when the worksheet is converted to a PDF document the picture (company logo) appears on the top right hand side of the page.
I can find the cell reference for the last column, and I can move the picture around the page. But I'm not sure how to find the position of the last column on the page?
I've got this far:
'copy picture and resize and position
Sheets("Output File").Select
ActiveSheet.Shapes.Range(Array("Picture 1")).Select
Sheets("External data sheet").Select
Cells(1, 10).Select ' I can make this be relative to the last column on the WS
ActiveSheet.Paste
Selection.ShapeRange.Height = 50
Selection.ShapeRange.IncrementLeft 0 'put the picture in a position relative to the cell selected
View 5 Replies
View Related
Mar 5, 2007
I need to change multiple conditional formats which apply to cell ranges 1 row x 17 columns wide. The specific change I am making is able to be acrried out with the code
With Selection.FormatConditions(1).Font
.ColorIndex = xlAutomatic
End With
However, I dont want the user to have to manually select each 17 cell area. I WANT THE USER TO JUST MANUALLY SELECT THE FIRST OF THE 17 CELL AREA. I want to write a macro that will THEN select a row of cells, 17 cells long, from the MANUALLY SELECTED position as at the moment of running the macro. Unfortunately the cells are not always on the same row in each sheet. On one sheet they may be on row 5, on another row 8 and on another, row 15 etc. I was wanting to be able to select a 17 cell range 'relative' to where the cursor is. How do I write the code to select the relative cell range? Is there an answer in an R[1]C[1]:R[1]C[17] sort of code?
View 7 Replies
View Related
Apr 9, 2014
My OS is Windows 7. My version of Excel is 2007. I have read how to get a macro to move around a page in a relative way, but is there a way to move from page to page in a relative way as well?
View 5 Replies
View Related
Jan 7, 2009
Is it possible to position a predetermined cell (e.g. A42) in the top left corner of the screen. (Not every screen users use has the same size)
View 3 Replies
View Related
Jul 12, 2013
I'm a fairly new user to using VBA and I'm currently running into a little snag. I'm trying tu create userform which will let me know if a person already exists in my sheet by looking up the last name in "A", then looking up his first name in "B", if such entry exists then display a message saying " Yes". If entry user has not been entered in the sheet then use a combox, to select the reason , then choose a date ( i have a working date picker ). Then entry should be entered in sheet (Name, Surname, Reason, date).
Whats working, I can use all of the above to enter all the info into the sheet, what I need to do is verify if user is alread in there, if not, then add it. The so on and so forth
View 3 Replies
View Related
Feb 26, 2008
i've managed to get a set of cells to show (with comments) what the last weeks data looked like. (so cell value = this week, comment contains last week)
What i now want to do is to use conditional formatting to highlight any major differences between the figures... so:
My comment i'm sure is stored as text in the format:
Previous value was
xxxxx
So the first thing i'd need to do is to to strip out the text at the start, and then perform the calculation.
View 9 Replies
View Related
Aug 5, 2008
I have the following code which previously was showing an error on the Do While line. It was suggested that I change the line too Range("B2").Text. However, the loop is not deleting the rows based on "#N/A". Can anyone offer any suggestions?
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess .....
View 9 Replies
View Related
Mar 13, 2009
I have a very large grid of data, about 400Rx200C, which contains a lot of blank fields. All of this data is currently in values from 0-100 representing percentages, but not formatted as such. I need to make all of these values into Excel Percentages so naturally used Paste Special and Divide from a field with the value 100 in it and then simply format the cells as %.
However, this fills in all of the original empty cells with a 0.000% which I do not want, I need them to stay blank. And some of the cells that do have values also have 0.000% so I cannot just delete all of these values with a VBA script. I had been hoping the Skip Blanks option would do this, but it does not unfortunately.
View 3 Replies
View Related
Sep 22, 2009
I am trying to write a Macro that will do the following.
1. Using a new workbook
2. Open a file in a in a directory. Then
3. Run a vlookup using the opened file as the filename in the vlookup
4. Paste the results of the vlookup into the original file next to the file name.
5. Close the file and open the next one in the folder.
The folder contains about 2k files that it needs to loop through. I found a macro on this site created by Ravishankar and attempted to add to it. Not going so well.
View 2 Replies
View Related
Jun 17, 2013
I have two subroutines. One subroutine updates some figures on spreadsheet 1, and then calls a subroutine that updates some figures on spreadsheet 2. Spreadsheet 2 is supposed to save and close, and return to spreadsheet 1, but it only gets as far as opening spreadsheet 2 and updating the figures. These are the two subroutines:
Code:
Sub UpdateLegalAndMeans()
Dim wBook As Workbook
Dim count As Integer ' counter for counting down backlog figures
[Code]....
View 4 Replies
View Related
Mar 28, 2014
I am creating a range of numbers from 1 to 2000 with increments of 0.5. Then I have to subtract certain range, for example, 100 to 350. So, the result should display, 1 to 95.5 and 350.5 to 2000.
View 4 Replies
View Related
Nov 20, 2006
Office 2003 with Windows XP
This is my first post so i may not have done everything correctly. I tried doing google searches to see if anyone else has done something similar but its a tricky thing to search for. I have found pages dealing with manipulating time but none seem to be what I want
I have an Excel sheet with data
A1=date
b1=source
C1-h1 all contain data (name, location, etc, etc) but I am not interested in those.
A1 (the date cell) is formatted like: m/d/yyyy" "h:mm:ss AM/PM
[Sample]
a2 = 8/1/2006 12:20:23 AM b2 = phone
a3 = 8/1/2006 12:21:13 AM b3 = email
a4 = 8/1/2006 12:33:03 AM b4 = phone
This is what I am trying to accomplish:
I want to break each hour, whether it contains data or not and get a count of the different types of source
my desired output would be:
time Phone email
12:00AM
to 2 3
12:30AM
My problem occurs because I am unsure how to break the times down into intervals. In my head, I would create a new column and try to break the time up into an interval. So for a2 (8/1/2006 12:20:23 AM), I think I would need to break the date and time up and then determine which interval would be needed based on the time.
I was going to perform the following:
=text(a2, "h" + if("mm:ss">30, 30,00)
Basically, pull the hour from a2 and evaluate the mins/secs.
If the min/sec is bigger than 30, put a 30 in the box. Less than 30, put double zero in the box. So for 8/1/2006 12:20:23 AM, b2 would have 12:00 since it falls in the 12 to 12:30 interval.
Once I have all the intervals, I would also need to preform a count on the source cell but I think I can use a vlookup to get the count for the interval.
View 9 Replies
View Related
Nov 21, 2006
I was given the following formula by Domenic some time ago that I use along with VBA code supplied by Fin Fan Foom to open do a lookup on a closed workbook:
=If(ISNUMBER(MATCH(MIN(If( Date=D2,If(ABS(Time-E2)<"0:30:30"+0,ABS(Time-E2)))),If(Date=D2,ABS(Time-E2)),0)),INDEX(Contact,MATCH(MIN(If(Date=D2,If(ABS(Time-E2)<"0:30:30"+0,ABS(Time-E2)))),If(Date=D2,ABS(Time-E2)),0)),"")
Everything works fine, until I attempt to…
- cut & paste a block of cells, or
- do a SaveAs, or
- change a worksheet name
The formula will no longer function after performing any of these tasks (the cells go blank), and I have to close the workbook without saving to preserve the original workbook functionality. All other tasks, including even importing of different files into the workbook have NO negative effect.
The formula uses an “INDIRECT” named range. Sheet name changes are reflected in the named ranges, but any change of names somehow causes a malfunction (no sheet names are referenced in the VBA).
I thought that the large lookup workbook (40,000 rows) may be a problem, but even after deleting most of the data and retaining only a few rows, the problem still remained.
After the formula cuts out (after performing the above tasks), if I open up the lookup file, then the lookup will work again, but if I close the lookup file, it will stop working.
I doubt the problem is in the VBA code since IT WORKS, and besides, I have other simple VLookups formulas that also uses the same process (and VBA code) and they continue to work just fine when that one formula gives out. The only thing I can think of is that the complexity of that one formula may be an issue.
Anyway, I the original thread is long, so I’m starting a new one here. The original thread is here (Domenic’s formula, pg 7; FFF’s code, pg 8):
Dedicated Cell To Choose Lookup Table
View 9 Replies
View Related
Nov 19, 2009
I have an array with dimensions (5000,30). I want to perform a worksheet function "Percentile" on specific columns within the array. So for instance I may want to know the element falling at the 50th percentile in column 5 of the 30 column array. Is there a way to do this without having to place the array onto a worksheet?
View 4 Replies
View Related
Apr 8, 2014
I have used a vlookup code from a past post (Vlookup multiple values in one cell) in VBA and successfully retrieved my information to one cell.
However, I would now like to remove any duplicates in this cell; preferably while running the same code.
--vlookup code
Public Function mVLOOKUP(mlookup_value As Range, mtable_array As Range, mcol_index_num As Long)
Dim r As Range
[Code].....
View 2 Replies
View Related
May 11, 2007
I have a set of data with names in col A, Currency in col B, Amount in Col C. I want to convert all the amounts in NON-USD based on exchange rate I input daily into column D.
How do i search down the row for the next name that is denominated in GBP / YEN etc and keep converting until I dont find any more other currencies in it. I tried to improvise on the finding nth but couldnt get anything out of it. Have attached a spreadsheet.
View 9 Replies
View Related
May 13, 2014
The spreadsheet has over 200K rows and two dozen columns. My job is to:
1. There are two columns, one is called OCR code where we have repeating ID's and other column is called Minutes Count which is basically a number. I have to filter the OCR column for similar OCR codes(values) and then add their time(Minute Count) so that I get total minutes for a specific OCR code. After adding the min I will copy them into a new sheet with the code in one column, total minutes in another and number of repeatitions for that specific OCR code or count number in a separate column. Example:
OCR_Code; Minutes
54xg; 456
45fk; 65
23IS; 18
54xg; 971
45fk; 265
.
.
.
Now I've to filter 54xg so that I can only see it and its corresponding minutes. Then I will add up all min for 54xg. Then I will count the number of instances a 54xg has been repeated in spreadsheet(here its 2 but it can be in hundreds in my case). Last thing is to transfer all this data to a new sheet. And automatically repeat the process for other OCR codes like 45fk, 23IS etc...
View 3 Replies
View Related
Jun 14, 2013
Looking for a way to search an active cell (that has been found using macro) for numerical data and if there is some present paste this in a different location
If there is no numerical data in this this cell then paste a 0 in a different location
An example of the string contained in the cell
Product 7.5% wheat <- i would want 7.5 (or 7.5%) copied to a different cell
or
Product X <- i would want a 0 copied to the cell the 7.5 would be in from the above
I can find the cell to search in, i just do not know the correct way to extract the information I need.
View 9 Replies
View Related
Jun 4, 2013
I would like to assign a value to a row so I can enter different quantities in a cell in that row, and then sum the total of multiple rows.
Example;
I want to add up c3-c10, d3-d10, e3-e10. I want to make row3=$4, row4=$5, row5=$6 etc.
So c3, d3, e3, f3 cells will have different totals ex; I type 10 in c3, 12 in d3 and 15 in e3... but they are values of $4, so
When I sum up a column c3 will actually represent $40, c4=$48, e3=$60 and so on.
Another example;
row3=$4 and row4=$5
i type 10 in c3, and type 5 in c4.
the sum of c3 and c4 = $65
How I assign a value to a row?
View 2 Replies
View Related
Oct 6, 2008
I've been doing a very simple table for my father's bass club. The club has one tournament a month and the 2 lowest weights are dropped. The table has a column of names on the left hand side, beside the name is 12 columns for one weight per month, right of that is a sum of the fisherman's catch weight in column O and to the far right is an equation that removes the 2 lowest weights =O4-(SMALL(C4:N4,1)+SMALL(C4:N4,2))
In the past I have put a 0 if someone didn't fish. He has asked me if it's possible to put DNF for Did Not Fish in lieu of a 0. This way they have that information and know how many people fished and caught nothing versus how many didn't fish. I need to know how to assign DNF a value of 0 for the whole table so that I can still drop the 2 lowest weights
View 3 Replies
View Related
Dec 1, 2013
I have a column with names (repeated names by month). There are about 3700 of them spread over 12 month. so it's about 300 names per month.
Is it possible to assign an ID (a number) to specific names?
So let's say - John Smith will have ID 1 (for example), and will always get this ID?
View 8 Replies
View Related
Dec 4, 2013
The first column shows the sample data. The second column is what I'm expecting.
How to assign a similar value to the duplicates and the unique ones should have the values in order
605-21501
605-21612
605-21501
605-26123
605-26134
605-21612
605-26195
605-21612
View 10 Replies
View Related
Sep 1, 2013
Can you assign a macro to the tab key?
View 4 Replies
View Related
Apr 4, 2014
What I'm trying to so is track weekly labor costs- my crew makes a rate for 6 days then an additional amount for a 7th day. I have attached an image of what I'm trying to do. Basically I want to add up the crew members "a" rate plus the "b" rate (if applicable) over multiple weeks in the total column.
View 1 Replies
View Related
May 27, 2008
I have created an add in for excel with all the macros that will be used for a particular workbook. I have some buttons in the workbook that I have macros assigned to them. I assigned them to the xls workbook before I saved it as an add in. Now, when one of the buttons is pressed, it opens the xls workbook.
how to assign the macros from the add in to the buttons.
View 9 Replies
View Related