VBA Returning Cell Range From Multiple Rows And Columns?
Apr 24, 2014
I'm attempting to match a name with the row and column numbers of data that is laid out in a grid format. It looks something like this:
Denson
Matthews
Smith
[Code]....
This works just fine, except for the fact that once in awhile the same name will appear in the grid twice, and the row and column returned will be off (it will return the row for one of the Smiths, for example, and the column for the other).
I know why this is occurring so I'm looking for a better way to do this. The good part is that I don't necessarily need both locations returned for each "Smith" ; I just need the correct row and column for at least one of the instances. I'm looking for a better way to do this.
View 1 Replies
ADVERTISEMENT
Oct 8, 2013
I'm working on a database right now for our school, similar to a directory. What I want to do is be able to look up what items a staff member has been issued and when/if they were returned. What I have right now is one sheet with all the information about the staff that looks like the one below. I want to create a separate sheet where you could look up a staff member by last name and can find all the information in the array relative the the specific cell looked up.
Last Name
First Name
Position
Building
Items
So, on the "lookup" sheet, I want to be able to input either Doe and have the look up return cells B2:E6, or if I input Smith it should return cells B7:D11.
I've been experimenting with Vlookup, hlookup, index, and match but haven't been able to get exactly what I want..
View 8 Replies
View Related
Apr 30, 2008
The purpose of my code is to time production cycles for heavy equipment. There are five - six segments in the cycle, and it's possible that not every segment is included in each cycle. It's also possible that the cycle will not go in sequential order.
Here's a snippet of
Sub MacroD()
Dim LR As Long
LR = Range("D" & Rows.Count).End(xlUp).Row + 1
ActiveSheet.Unprotect
Range("D18:D" & LR).Value = Now
UserForm1.ListBox1.Text = "Time"
UserForm1.ListBox1.SetFocus
' UserForm1.Show
End Sub
Sub MacroF()
Dim LR As Long
LR = Range("F" & Rows.Count).End(xlUp).Row + 1
ActiveSheet.Unprotect
Range("F18:F" & LR).Value = Now
UserForm1.ListBox1.Text = "Time"
UserForm1.ListBox1.SetFocus
' UserForm1.Show
End Sub
My problem is that when the macro runs, it returns the time in more than one row and overwrites the previous timestamp. It starts in row 17, and will record the first time in 17 and 18. When the macro is run again, the time will be recorded in 18 and 19. When it's run a third time, the timestamp is recorded in 18, 19, and 20. So essentially, I'm losing all of my previously recorded data. When I finish, all I have left is the timestamp in row 17 and whatever the last time recorded is.
View 13 Replies
View Related
Nov 6, 2009
This is a floowup to the issue that was originally posted as "Returning MAX/MIN values from multiple rows in a named range ". I marked that post as solved since I have worked through part of the issue and since have a different one.
View 2 Replies
View Related
May 13, 2008
I would like to rows based on multiple column conditions criteria. ie., if the columns N, O, P values are "", then hide the particular row. The logic given in the website here, i tried But, it is not 100% working. It works for a few rows at the start of the database & it works for the rows at the end of the database. In between, for a few rows, even if the column values are "" it does not hide those rows.
View 2 Replies
View Related
Mar 6, 2014
I am using the following range to copy data from Column A (from rows 3 on the the last row). How can I include Columns B and C into this range also, but still using Column A to find the last row?
[Code] .....
View 9 Replies
View Related
Oct 20, 2006
I posted this on Mr Excel, but did not get an answer. I hope someone here can help.
I have a rather large financial worksheet that I am trying to extract some specific data from.
The sheet contains budget and expense #'s for the fiscal year for several projects. The project names are listed in column G and the same project can be on multiple lines, depending on what the expense is. Column J contains either "Cap" for Capital, or "Exp" for Expense. The monthly data starts at Row L. Each month has 6 columns, the one that matters for this scenereo is the 5th one for each month, which is the Forecast Column.
Our Fiscal Year is April 1 - March 31, but this sheet ruins from March - March so that we can carry over anything from the previous year. So the forecast column for March is column "P", April is column "V" and so on, adding 6 columns for each month.......
With me so far?
What I am trying to do is get the total forecasted expenses amount for a specific project for the remainder of the fiscal year.
In other words I need to look for a specific Project Code in Row G, look for "Exp" in Row J, Then get only the numbers that are in the Forecasted Column for months in the future and add them all up.
Just in case that is not totaly clear----
criteria to meet
Column G = "Project Code"
Column J = "Exp"
Row 2 > this month
Row 3 = Forecast.......................
View 9 Replies
View Related
Feb 7, 2014
Certification and Training tracking.xlsx
I want to create a certification only list on a separate tab of training that has been completed where a certification has been issued (as indicated by a "Y" in the "Certification?" column on the training tracking tab) and then populate from some of the fields vs. all of the fields.
What I have now, only pulls the first occurence, not all occurences. I saw that I could have identified the multiple columns that needed to be populated, but it didn't work either, so I'm fine putting a separate vlookup in each column.
View 6 Replies
View Related
Jun 10, 2013
I have a spreadsheet of prices (raw data), and I need to pull out both the most recent price for each item for a specific customer code for each item, as well as the second most recent price, (essentially the old price), for that customer code for each item.
I have columns for ITEM (code), PTC (Customer Code), PRICE, and EFF (Effective Date). For each item code, there are multiple prices for multiple customers, such as in the linked workbook.
I am currently using the formula, =INDEX(PRICE,MATCH(1,(F2=ITEM)*(G2=PTC),0)) to pull out the last price. This works because the last price is on top based on sorting. What I need is a formula that pulls out the next oldest price for that item/ptc combo. I tried using the SMALL function to no success.
[URL]
View 2 Replies
View Related
Apr 18, 2014
I have attached a file with an example of what i am looking for. The data in columns A and B are my original Data. There are multiple instances of e-mail address on the left but I need to bring in each data horizontally. I would like a formula to enter into E2:J6 to pull the information in.
Book2.xlsx
View 9 Replies
View Related
Mar 19, 2008
Im writing a macro and have a cell activated (using ActiveCell). If I want to select this cell (the activated one - i.e., k3) along with the 2 cells next to it (i.e., l3, and m3), how would i go about doing that?
I'm wanting to shift 3 cells downward and I know how to shift them down, but dont know how to select the cells i want.
View 5 Replies
View Related
Feb 5, 2013
I have two workbooks at the moment, one which holds a whole host of customer and accounts details and another which holds only the customer details. What I'm trying to do is cross reference the two to determine if a customers details appear on both and if they do highlight this, ultimately I'd like it to pull the customers account number back but even if it highlights a match that would be sufficient.
The only unique criteria I have to do this are customer surname and customer postcode.
In the Customer details spreadsheet I'm attempting to enter a formula which will look at the specific surname & postcode held on the row in which it is entered. It will then look at all of the rows on the other spreadsheet and determine whether any of them meet both criteria.
If they do I'd like it to display "match" if they don't I'd like it to display "no match"
View 2 Replies
View Related
Feb 19, 2010
I need to accomplish selecting a range using variables for the starting cell and ending cell rows and columns.
Pseudo code (how I'd like the syntax to be, but isn't):
Worksheets(mysheet).range(startCellRow, startCellCol : endCellRow,endCellCol).Select
With Selection
...
End With
View 6 Replies
View Related
Jan 15, 2010
I have created a spreadsheet to show some reports and I wanted to serch for some datas which overloops themeselves. If you can have a look at a test file I attached you will see the full picture. I have 2 tables, where the 2nd one is on the right side of the 1st one. 1st table:..............
View 3 Replies
View Related
Apr 8, 2013
i have the sheet which have the table which look like
Person task done
A 5
B 4
C 1
D 1
now i want is there is any way to find minum value in task done colium and return the person name and like in this exapmle, 2 person have done have done minium work.. it tell me both those name
View 5 Replies
View Related
Jul 11, 2014
From the following example:
A1 TAG B1 mileage
G10-1622 15246
G10-1622 15246
G10-1583 15246
G10-1622 28659
G10-1195 28659
G10-1622 28659
desired results
Enter tag in cell
G10-1662
Mileage
15246
15246
28659
28659
I would like to enter a particular TAG # in I5 and return all the mutiple associated data
See attached : tire2.0.xls‎
View 9 Replies
View Related
Feb 5, 2014
I have this data inputted into excel sheet: [URL] .......
This data is in tab called Shops, that has 8 columns of information. In another sheet called control, I have the shops names from row A in a list box. What I am trying to do is when whatever shop is selected in the list box then output the shop information from that row in 8 different cells in another sheet. I have a list of about 200 shops that I need to input.
So if we pick shop, Abc inc from the list box how can I get excel to look up the information in Abc inc in the shops tab of information and then display them on other cells in different sheets.
I have the same issue with making a list box of people names. I made the list box but I want to make it so it will display there phone number and e-mail address in 2 other cells once you pick there names. I had some luck using the if command on smaller list boxes but I can't figure out how to get multiple cells of information to come out correctly
View 1 Replies
View Related
May 22, 2013
I need to return the specific text of a cell based upon the text in multiple cells.
Worksheet as follows:
Asphalt Sub:
BLDG1-Backwash 1
*BLDG1*
*Sub*
BLDG1-Backwash 1 OverEx
*BLDG2*
*Sub*
[Code].....
I have three columns thus far. I need to add another column and search all items in Column A using the criteria in Columns B and C. For instance I need to search for BLDG1-Backwash Sub: and place it into column D using the criteria in Columns B and C.
If possible, I would also like to remove both the words, BLDG1 and Sub from the result so then it only shows "Backwash".
My spreadsheet is much larger than this and I have muliple buildings I am dealing with, sometimes 30-40.
View 4 Replies
View Related
Mar 13, 2014
I want to to copy selected columns of sales data into rows organized by salesperson. I have just started out with VBA and find that I cannot do it myself.
My original data are in the form of the following:
invoice_no
product
sales
qty
total
[Code] .....
I want to display the data in another sheet in the following format:
sales_a
sales_b
sales_c
sales_d
[Code] ...........
View 2 Replies
View Related
Dec 18, 2006
1. Copy data from original file (I do not want to do anything in the original file) into the spreadsheet (Target worksheet)where the code should run.
2. In sheet 1 of Target Worksheet, there are 2 columns which I need to set criterias on namely Column D and Column L
3. In Column D, I want to specify 3 criterias namely A, B and C
4. In Column L, I want to specify 5 criterias namely London, Frankfurt, New York, Sydney and Tokyo
5. If Criterias in 3 and 4 are met, copy all rows into Sheet 2 of Target Worksheet
View 9 Replies
View Related
Oct 29, 2008
I need to find all rows that have columns that match in all 3 of the columns.
I then need to delete all but the last row in each "group" of rows.
like:
1 q w e
2 q w r
3 q w r
4 q w r
Delete rows 2+3
View 9 Replies
View Related
Jun 15, 2012
I have the following code in Destination.xlsm that is intended to:
request the user to select a multi-cell range in a column of single-sheet Source.xlsm, in which some but not all cells contain "Y" (to indicate that this row of data relates to a National Account, versus a Territory Account)loop through the selected range, and whenever a cell contains "Y", copy the entire row and insert it in Destination.xlsm above a cell named "rngDest".
Code:
Sub Copy_NationalAccounts_Rows()
Const Message As String = "Select the entire range containing National Account Y flags, then press Enter or click OK."
Const Title As String = "Copy National Accounts"
Dim rngSource As Range
Dim rngDest As Range
Dim r As Range
Dim c As Integer
Dim wbk As Workbook
[Code] ........
View 5 Replies
View Related
Oct 10, 2008
I have a large spreadsheet that contains and employee number and then up to 5 entries of Dependants (each has its own column). What I need to do is have 1 for each of the dependant information instead of 5 and have multiple rows for the employee if they have more than one dependant.
At the moment I am sorting the data by dep 1 name, pasting the data into a new sheet, deleting all the dep 1 stuff, sorting by dep name 2 and pasting that.........etc.
It doesn’t take too long to do but I just wondered if there might be a quicker way as this will be something I will need to do more often.
View 2 Replies
View Related
Jul 10, 2013
create a formula,for multiple criteria with multiple results in rows.
[URL]
View 1 Replies
View Related
Jun 19, 2009
I have a sheet that is organised as follows:
a) Column A contains 50 names, all unique. R1C1 heading is "Name".
b) Column B to Column H are for some text that can contain special characters, numbers, spaces etc.
c) R1C2 heading: "Day 1"
d) R1C3 heading: "Day 2". and so on till R1C8 having heading as "Day 7"
e) All the cells are filled in the specified range as specified in (b) above.
In summary, each of the names will have 7 different tasks associated with it in the row. These tasks can repeat for all the names.
For example: Consider the below set of data for 3 rows and 7 columns (spaces are used as column delimiter. In reality, spaces can form part of the tasks for each name):
Name D1 D2 D3 D4 D5 D6 D7
-------------------------------------
aaaa T1 T1 T1 T2 T3 T4 T5
bbbb T1 T2 T3 T3 T3 T4 T5
cccc T1 T4 T4 T4 T4 T4 T4
I hope its clear till this point.
Now my requirements are as follows:
a) Find out all unique elements from the set of tasks across all days and list them from 100th row onwards with each unique entry in new row.
b) For each of the unique tasks, list the names that have worked on that task in the same row.
For example, the output should be as follows:
T1 | aaaa, bbbb, cccc
T2 | aaaa, bbbb
T3 | aaaa, bbbb
T4 | aaaa, bbbb, cccc
T5 | aaaa, bbbb
The character "|" above is used as a seperator for columns.
View 5 Replies
View Related
Oct 21, 2013
Date
Name
Diesl
Petrol
Oil
Kerosene
[Code]...
Here from the above table i want to get the complete sum of all numbers corresponding to a specific date and person..
I used sumifs which looks like this: =SUMIFS(C2:F10,B1:B10,A12,A1:A10,B12)
But that doesn't work, should i resort to using multiple sumifs?
View 1 Replies
View Related
Oct 24, 2012
Using the following code to remove empty rows based on whether a specific range of columns is empty. The code works if the cell has a zero, but not when the cell is blank. An example of the data is attached.
VB:
Public Sub DelRows2()
Dim Cel As Range, searchStr, FirstCell As String
Dim searchRange As Range, DeleteRange As Range
[Code].....
View 1 Replies
View Related
Nov 20, 2013
I have following information. I need to transpose the columns into rows
C
10001
V
1000
V
1001
V
1002
C
10002
V
1001
V
1003
C
10003
V
1001
V
1003
V
1004
The expected result should be like
10001 1000 1001 1002
10002 1001 1003
10003 1001 1003 1004
View 4 Replies
View Related
Mar 9, 2014
I'm trying to move multiple ROWS to COLUMNS. My data looks like this:
ID CLASS_NBR1 UNITS_TAKENGRADECLASS_NBR2UNITS_TAKENGRADE CLASS_NBR3
000555 688 1 A
000555 567 3 B
000555 888 1 C
000555 999 1 B
000555 889 3 C
101999 889 3 A
101999 567 1 B
I have between 4-9 rows that I'm trying to move to columns. I'm attempting to move data for each student on one row, currently each student has between 4-9 rows.
I've tried so many different formulas and MACROS that didn't work I started doing this one by one (manually) but I have too many rows and it's taking too long.
View 14 Replies
View Related
Mar 25, 2014
I have an interesting problem I've been presented with and rather than try formula after formula I thought I'd propose it to you all (see attached sheet).
I have 7269 rows with 1930 distinct claims. I need to pull out the Primary issue (done that) then across from it put in each and every secondary issue (from col C). The largest # of claim lines is 89 (see E1). So in theory I need to find that claim and put all the secondary issues in the next 89 columns from row 4990 beginning in col H.
I've done a couple examples of what I'm looking for in rows 2, 4 and 5 and 8 but beyond that ...
So every place where there is a value in col F I'd like the list of secondary issues in the same row.
View 4 Replies
View Related