Shifting Cell Data To Top Row
Feb 13, 2009
I need a macro to shift column data to the top row for a given cell range sharing common data in row A.
I need to get from this:
Name Fruit Meat Dairy Bakery Alex Apples Alex Milk Alex Bacon Alex Bread Bill Steak Bill Eggs Bill Chicken Bill Oranges
Carl Butter Carl Cake Carl Milk Carl Bananas Carl Pork Carl Peaches Carl Chicken
To this:
Name Fruit Meat Dairy Bakery Alex Apples Bacon Milk Bread Bill Oranges Chicken Eggs Bill Steak Carl Bananas Chicken Butter Cake Carl Peaches Pork Milk
It would be nice if the shifting would sort the data as well.
View 9 Replies
ADVERTISEMENT
May 8, 2014
I have a 2010 excel sheet containing 14 columns and 45082 rows in total. I am quite illiterate when it comes to writing macros but I know that what I need can be achieved with a set of codes.
To be more clear, I inserted two tables below. The first one represents the current data structure, and the second one is the way I want my data to look like.
Current data structure looks like
Variable 1
Variable 2
Variable 3
[Code].....
View 9 Replies
View Related
Aug 19, 2009
This is far too complicated for me to program.
Ideally, if at all possible, I want a macro that will align every row of my data by the cell which has the value closest to 20. i.e.
8 10 12 14 16 18 20 22 24 26 28 30
9 12 15 18 21 24 27 30 33 36 39 42
5 10 10 10 12 10 14 50 54 59 62 72
1 10 40 42 44 46 48 50 56 48 62 70
would become...
8 10 12 14 16 18 20 22 24 26 28 30
........9 12 15 18 21 24 27 30 33 36 39 42
5 10 10 10 12 10 14 50 54 59 62 72
.....................1 10 40 42 44 46 48 50 56 48 62 70
As you can see, it looks quite tricky.
If it's too complicated, I can do it by hand (very time-consuming) and a simple macro button would help. I'd need something that will select the whole row of the active cell, and shift it all one space to the right. I'd have another button doing it to the left.
View 9 Replies
View Related
Feb 12, 2014
Any way to automatically shift the numbers in a calculation range without having to manually enter for =SUM every time.
The spreadsheet shows a listing of the 20 most recent golf scores in one column, and the other column adds the best 10 of the most recent 20. Currently I am doing this by hand, and just entering the sum in the top cell. Is there a way once I enter the newest score for excel to read that and automatically adjust the formula?
View 7 Replies
View Related
Oct 23, 2008
I'm looking to create a program that enables the macro to run with placing the desired cell blocks (A3:F12) from Sheet1 into Sheet2, and when i press the shortcut key again, it automatically places the cell blocks underneath the previous data that was pasted in the Sheet2. The goal of this is to keep a history of the data into the Sheet2.
I'm new to this, especially with VBA but is there any possible way to create this type of macro program?
View 12 Replies
View Related
Jul 23, 2013
I have an array defined from 1 to 100; however, only six elements of the array have a value. I need to add a value in between the ones already in the array. I have tried this snippet already with no luck.
Code:
For Z = a To MinPos
WOList(Z + 1).F1 = WOList(Z).F1
Next Z
WOList(MinPos).F1 = CalcValue
A is defined as the total number of elements with values in the array (6 values in this example). MinPos is defined as the location of which the value needs to be inserted (lets say index 2). I tried to shift all the elements to the right one, and add the number into the array.
View 4 Replies
View Related
Sep 21, 2008
I had a sheet that had a web query imported into it which took up columns A to F. The web query varies in length upon every refresh. In columns G onwards i have lots of formulas that read the information from the query to produce results.
When i imported the web query, on some refreshes it has the ability to push my formulas down in certain columns. I'm assuming this is because the length has changed of the web query maybe? Although it can do it on the opening import of the query which i find strange.
I was told the best way around this would be to put my web query on another sheet, however this doesnt appear to have fixed my problem.
Lets say for example #Sheet1!A1 looks at #Sheet2!A1, #Sheet1!A2 looks at #Sheet2!A2 and so on. This will work fine. When the web query is imported into Sheet 2, its data goes down to cell A72. Upon another refresh though, the length will changed and now the data might go down to cell A81. However, #Sheet1!A72 will have changed its formula to look at #Sheet2!A81 and my formulas on Sheet 1 will now read as follows:
#Sheet1!A69 = #Sheet2!A69
#Sheet1!A70 = #Sheet2!A70
#Sheet1!A71 = #Sheet2!A71
#Sheet1!A72 = #Sheet2!A81 <----- Problem!
Basically the problem with this is Sheet 1 will not be including Sheet 2 A72:A80 which i also need.
View 9 Replies
View Related
Jul 26, 2007
I have a challenge for any macro wizard out there - this is something I really need and I'd be happy to reimburse whomever can help with an iTunes gift card or something.
I regularly receive a dataset such as the one you see here on the tab called 'Data comes in varying # of rows' (either link should work):
[url]
[url]
The dataset comes each time with a different number of rows, and what I need to do is combine all the 'Issue' and 'Issue Description' columns (there are 8 total) into just two columns.
I think this should be relatively easy for someone who has a better knowledge of macros by simply copying and pasting the data on top of itself (as I have done on the next tab called 'Want to change to this format'), and then simply deleting from the second section the 'Issue #1' and 'Issue #1 Description' columns, and shifting all the data left by two columns.
If you repeat this process for the third and fourth sections (for the third, you must delete 'Issue #1' and 'Issue #1 Description' and 'Issue #2' and 'Issue #2 Description' and shift the data left, while for the fourth you must delete Issues and Issue Descriptions 1 to 3 and shift the fourth Issue and Description to the left), you will end up with the columns A, B, C, and D as I have on the 'Want to change to this format' tab. (The extra columns after column D should all be deleted.)
Finally, the 3 extra header rows that are now at the top of the bottom three copied-and-pasted sections should all 3 be deleted.
View 5 Replies
View Related
Nov 16, 2013
I have been trying to produce a spreadsheet that works out the correct gear and rpm depending on shift limits across six gears.
In column M I have all of the rpm values for 1st gear, which I require in column S until the shift limit for 1st gear is reached, now I wish to have the rpm values for 2nd gear (Obtained now from column N) displayed in column S up until the 2nd gear rpm limit is reached and so forth until 6th gear. I have tried an IF() statement down the entirety of column S but this only seems good for taking into account two columns at a time, whereas I require six all dependent on the respective gear shift rpm. Also the position of the shift rpm will change relative to other functions in the spreadsheet, so I can't simply have different IF() statements lined up appropriatly in column S.
So if my shift rpms are in column B I wish column S to read column M until M>B1 then it will need to choose values from column N until N>b2 where it then picks column o and so on.
View 6 Replies
View Related
Aug 13, 2009
I was wondering if there was a way to create a two cell dynamic range that doesn't expand, but instead shifts.
The cells that I'm interested in are always at the bottom of the column of data. For example, the first two cells I want as my range are C13 and D13. Then, for my next use of the range, I would like it to include C14 and D14.
View 11 Replies
View Related
May 4, 2014
I began to ponder a way to copy down cells so that the copying of the formulas results in references as shifting horizontally instead of vertically. One particular reason that this occurred to me had to do with my attempting to use Excel to make more orderly text copied from Adobe.
So, for example, if I copied text from Adobe, I would paste it in Excel. Thirty lines of text would past vertically into a column, from Row A1 to Row A30, with each line of text in its own row. I wanted to figure out a way so that in adjacent columns, I could put it so that I would have a set of formulas reading in =A1 in Column C cell/row 1, =A2 in Column D cell 1, =A3 in Column E cell/row 1, =A4 in Column F cell/row 1, =A5 in Column G cell/row 1, and so forth. I realized that if I copied this down, in the second row, the result would entail references to A2, A3, A4, A5, A6. I would prefer that the references update to A6, A7, A8, A9, and A10.
View 5 Replies
View Related
Feb 4, 2014
I am looking for some code that will use A,B,C as filters to find duplicate cells, and if duplicate found, there should be deleted the duplicated row (but not only the row from a,b,c column, but the whole 8 cells from that row - A,B,C,D,E,F,G,H).
As filter I would like to be used A,B,C columns.
EXAMPLE:
BEFORE
A B C D E F G H
Kristijan Markovski 26,2,1992 1389 Prilep Prilep Mice Kozar1 1
Kristijan Markovski 26,2,1992 1389 Prilep Prilep Mice Kozar01 1
Kristijan Markovski 26,2,1992 1389 Prilep Prilep Mice Kozar001 1
Bojan Smileski 5,2,1992 1356 Prilep Prilep Borka Taleski 1
AFTER
A B C D E F G H
Kristijan Markovski 26,2,1992 1389 Prilep Prilep Mice Kozar1 1
Bojan Smileski 5,2,1992 1356 Prilep Prilep Borka Taleski 1
View 1 Replies
View Related
Sep 7, 2012
how to shift data in a column down multiple rows while in an IF statement. I am assuming you cannot just simply repeat the insert cell formula.
Here is my code - it's ugly but it was working when I just needed it to move down one cell:
lastrow = Range("A2").End(xlDown).Row
For i = 2 To lastrow
Range("B" & i).Select
If Range("B" & i).Value = Range("B" & i).Offset(-1, 1).Value Then
[Code].....
View 1 Replies
View Related
Nov 4, 2008
I have the code below that clears colums B-J and L-N in whatever row you activate a cell in. When a row gets cleared, how do I shift all the other rows up to eliminate blank rows in between the data real-time? I've deactivated the cut function already since this messes up references in the worksheet, so it would have to only use copy, paste, and clearcontents functions. Also, I don't want to DELETE any rows, just essentially shift the blank rows to the bottom. So when a row is cleared, all others shift up and the blank one goes to the end of the data that is available for data entry, so rows 17 to 116 are always available. But it must check to make sure that B-J and L-N are ALL blank, otherwise some wanted rows with one piece of information might get cleared. So at any given time, my range will always go from row 17 to 116. This is Excel 2007. Here is the code I have to clear rows that can be built upon.
View 14 Replies
View Related
Jan 6, 2009
The merged Cell B6:G6 will receive a ten-digit number followed by a dash and then one or more numbers. (For example: 1234567890-123)
Cell B15 will then receive data shortly afterwards. I already have a validation macro for this cell which allows either 'I' or 'I I I'.
Upon exiting Cell B15, merged Cell B16:H16 needs a macro which will check Cell B15 and if it contains 'I', Cell B16:H16 will display the data from the ten-digit number entered in Cell B6:G6 minus the first five digits. (For example: 67890-123)
Now the data in Cell B16:H16 can only be somewhat editable hereafter. It can be erased or replaced with numbers in smaller or greater digit combinations than five before the dash (i.e. 67890-123 can be replaced with 123456-7), and digits can be added after the whole group (i.e. 67890-123 & SEE DWG) without any error messages. But if any five-digit number with a dash and some numbers exist in Cell B16:H16, they must correspond with the number in Cell B6:G6 minus the first five digits.
However, if Cell B15 ever receives a 'I I I' afterwards, all data in Cell B16:H16 must be erased. Cell B16:H16 can never contain data if Cell B15 contains 'I I I'.
Also, if the data in Cell B6:G6 changes later on, the corresponding digits in Cell B16:H16 must change as well, even if there are digits after the whole group.
So here is an example of what a good macro would do for me: ...
View 14 Replies
View Related
Oct 14, 2009
I have an Excel workbook which contains data entry fields, which have different types of data validation rules - like Lists, Date, Whole Number.
I do not want end users to remove these data validations as well as the formatting of these cells by doing copy/paste. So, I have implemented techniques mentioned in the following post, and elsewhere - to override the paste functionality and implement PasteSpecial values automatically.
[url]
To keep it simple, I'm only supporting pasting a single cell at a time.
Now my problem is this:
Doing the PasteSpecial values programmatically doesn't prevent the user from pasting values in the cell that violate the data validation rules. So, I can paste a string into a cell having data validation as Whole Number, or a invalid string into a cell having data validation as List.
The following post just suggests disabling paste whenever data validation is present:
[url]
But I would like to allow the paste operation if the value being pasted is a valid value for the cell's data validation.
View 9 Replies
View Related
Jan 12, 2014
I want to do (seemingly easy task) of getting a price from a code, from a code sheet.
EXAMPLE:
Sheet1 (Log sheet)
A1 = "Code456"
A2 = $? <- This needs to be found.
Sheet2 (Price Sheet)
A1=Code123 B1=$1
A2=Code456 B1=$2
A3=Code789 B1=$0.50
Etc, and so on...
What I want to do is basically (without using macros):
"If A1 = sheet2:A1, then
A2 = sheet2:B1, halt. , ELSE,
If A1 = sheet2:A2, then
A2 = sheet2:B2, halt. ELSE,
So on and so forth..."
I thought there might be an easy way to do it with some sort of 'double sided' data validation drop downs or OFFSET function but I cant figure it out.
View 3 Replies
View Related
Jul 15, 2014
I wondering if it is possible for a macro to recognise whether or not there is text in an adjacent cell, and if there is, then to copy data from another adjacent cell.
For example, because there is data in C2, data from A2 has been inputted into B2. And any blank cells are left alone.
a
b
c
d
e
ref1
(cell A2 data here)
DATA
DATA
DATA
ref1
View 5 Replies
View Related
Oct 22, 2012
I have been wracking my brain around how to put this formula together.
Is it possible or it can't do more then 1 cell at a time?
Here is an example:
If F1= button request and E1= Scoring then OK (take no action) also i want to add that Folder in F and Corrupt in E would = OK
If it doesn't match to highlight the cell in red
View 8 Replies
View Related
Dec 12, 2012
i want to match a cell data with a range of cells and if matches return the cell reference in another cell
View 3 Replies
View Related
Feb 4, 2008
I am looking for a way to do what i would call a dual vlookup.
i have some data in a number of sheets and need to do some consolidation into a summary sheet. problem is, not all the sheets have data in the same columns and rows but all the data is the same.
what i am trying to do is something like
vlookup("a",sheet2!A:M,***need to put the column of the data here***,0)
i cant just put in the column number because it changes on each sheet, need some way to do another lookup there, like an hlookup or something, so that i could lookup which column contained 'sales' and return that number so it can be put into the vlookup.
View 9 Replies
View Related
Jun 19, 2008
I have 2 problems relating to LOOKUP.
Not sure if Excel can perform these calculations as they could get to complex.
Problem 1
Can it be possible to have excel look at data from one cell reference another cell then display the results from the cell next to it in another cell, sort of example:
Tab 1 (Never changes)
AB
Bob1
Jon2
Fred3
Tab 2 (Dynamic, changes each week)
AB
Jon
Fred
Bob
So it would work as follows.
Tab2 column B will take Tab2 column A’s data check Tab1 column A and display Tab1 column B’s result.
Problem 2
Weekly league rank table that shows position movements week by week
Example.
Week1
1Jon
2Bob
3Fred
Week2
1FredUp 2
2BobNot Moved
3JonDown 2
Can Excel calculate/show the actual movements of league positions?
View 9 Replies
View Related
Jul 15, 2014
I have a table in the format below with about 3500 rows
Column A
Column B
0001
All vehicles, Retirements
0002
All vehicles, Retirements, Addition
0003
All vehicles, Retirements, Addition, Deletion from Y
I would like to change it to the following format:
Column A
Column B
0001
All vehicles
0001
Retirements
0002
All vehicles
0002
Retirements
0002
Addition
0003
All vehicles
0003
Retirements
0003
Addition
0003
Deletion from Y
View 3 Replies
View Related
Jul 24, 2014
Looking for a formula to accomplish the following:
I'm trying to populate cell A31 on a worksheet titled "VolumeTotals" with the data in Cell E23 from a worksheet titled "CurrentCustomers" if the merged cells F3-F22 on worksheet "CurrentCustomers" are equal to the word "Contract".
View 6 Replies
View Related
Aug 17, 2009
I want find the data in some rows that same with one or more cell and automatically fill the data. And for more details, I have attached the examp file (Examp.xls).Antoni
View 3 Replies
View Related
Apr 14, 2008
I have a bar chart that was made from table 1 which has the value in it. I have another table, table 2 that has the name corresponding to the value in table 1. I want to color data points in a bar chart with a different color for each name I have in table 2. I also want to give a data label in the data points with the value I have in table 2 instead of the original data label from table 1. Is it possible to do it?
View 3 Replies
View Related
Apr 16, 2013
I am using Excel 2010. I am a novice user.
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.
pathA/path_X/path_Y/path_Z/lso0_rxs_reg_254__5_0/d
pathA/path_X/path_Y/path_Z/lso0_rxs_reg_253__5_0/d
pathA/path_123/path_456/data_out_reg_17_0/d
pathA/path_123/path_456/data_out_reg_0_0/d
pathA/path_X/path_Y/path_Z/lso0_rxs_reg_255__5_0/d
[Code] .........
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.
pathA/path_123/path_456/data_out_reg_0_0/d
pathA/path_123/path_456/data_out_reg_17_0/d
pathA/path_123/path_456/data_out_reg_4_0/d
pathA/path_X/path_Y/path_Z/lso0_rxs_reg_230__6_0/d
[Code] ......
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
26 pathA/path_123/path_456/data_out_reg_0_0/d
32 pathA/path_123/path_456/data_out_reg_17_0/d
8 pathA/path_123/path_456/data_out_reg_4_0/d
So my table would show the name "data_out_reg" and the range of values 8-32
View 1 Replies
View Related
Dec 17, 2013
I have 2 sheets in 1 document 'April Events' & 'Event Staffing' and I need to do the following
Basically, If 'April Events C5' contains any data, 'April Events D5' gets filled with the data value from 'Event Staffing G5'. If 'April Events C5' is blank, 'April Events D5' would be left blank. If 'April Events C6' contains data, 'April Events D6' gets filled with the value from 'Event Staffing G5' or left blank. If 'April Events C7' contains data, 'April Events D7' gets filled with the value from 'Event Staffing G5' or left blank e.t.c
e.g 'Event Staffing G5' = £12.57. On 'April Events' (C5=12, D5=£12.57) (C6=191, D6=£12.57) (C7= , D7= )(C8=1, D8=£12.57)
Is there a function/formula to do this?
View 3 Replies
View Related
Jun 6, 2014
I would like to be able to sort the data in this one cell alphabetically without retyping the data .ie use a sort function but only for a cell.
For Example cell A1 contains Chris Brown Andy
No commas there. Names are seperated only by spaces.
What function should I use in order to get Andy Brown Chris ?
View 5 Replies
View Related
Jan 23, 2013
I have a spreadsheet full of data and I need to extract only those lines of data which can be identified by the last three letters in a cell. I am adding an example spreadsheet which highlights the rows I am trying to extract based on the contents in column B but only where column B ends in KY.
Example data extract requirement.xlsx‎
View 5 Replies
View Related