Merge pasted into Excel cells - excel

I have a table in Word, each row is a few lines of text (shift + enter).
When I copy the table to Excel every line of copy to my own line. You can copy (each line where it was used (shift + enter)) to one row in Excel?
My table in Word.
Copied table to Excel.
I want to Row1 Text - Row1 TextC was A1. I know I can merge, but I have a big table and looking for solutions, which will accelerate.

This isn't 'easy' presuming you're comfortable with excel you're going to need to either use the VBA environment or have a few additional columns.
One way would be to identify the 'top' and 'bottom' of each Row by; in column C (starting from C2, C1 is always "top") =if(left(c2,4)<>left(c2,1),"Top", if(left(c2,4)<>left(c3,4),"Bottom","middle"
Then in column D (and cell locking is important, also assumes it goes to row 100, you will need to change this)
if(or(C1={"bottom","middle"}),"",$A1 & " - " & index($A1:$A$100,match("bottom", $A1:$A$100,0)))
This will give you a list, with breaks in which you can either remove by copying and pasting column D to a new sheet as values, pressing F5 and removing blanks. The other way would be to remove duplicates from the pasted list, and then take out the blank wherever it appears.
There may be more efficient ways of doing this, but it's a pretty unique question!
Maudise

Related

How do I take all values in a column and change their values

There are a lot of questions on how to multiply all values by some other cell or to move all values to another cell based on some value, but what I want is to take, in the example image below:
All the values that I have selected and divide by 2. I do not want another column, I just want to change all those values in the spread sheet and divide them by 2, the values themselves should change.
I have not found an answer for this any where and I sure it is super simple. For example, in:
base_damage_mod selected column, 0.03 would become: 0.015.
The only way I know to do this is manually, and that's a lot of work ...
Whats the easiest way to do this?
The easiest way to do this is by writing a macro, like in the following example:
Sub Divide_by_2()
For Each c In Selection:
If c <> "" Then
c.Value = c.Value / 2
End If
Next c
End Sub
In order to launch this, you need to select your cells (no need to copy, or press Ctrl+C), and then launch the macro.
As far as the source code is concerned, this is pretty obvious, except for the c <> "" part: I have added this in order to avoid the value 0 being filled in in empty cells.
Is there a way to do this without VBA, without macros?
Yes, there is, but it involves you creating a new column, in there type a formula, then copy the values of that formula into again another column and remove the first two columns, in other words: it's quite Messi :-)
If column C is empty (if not, temporarily insert a column), enter a 2 there next to every used column D item (*).
Copy all of column C, and "Paste Special" onto column D using Operation>Divide.
(*) If there are too many items to manually do the "2", copy this formula down column C =IF(ISBLANK(D1),"",2) and it will add them. After this, convert column C from formulas to values by copying it and using "Paste Values" to paste it back. (Special Operations won't work on formulas)

Copy Block of Data with Blanks to Other Location

I'm reusing this string from another thread to copy a whole column WITH the blanks (needed for alignment of other information) to a new location. BUT I see that its copy action will stop at the first blank AND infact it does. What I need it to do is copy the blanks and everything as a block then put it under the Range as below. I considered filling all the blanks first but that just sends the fill value all the way to infinity. There will be more blanks than data.
Range(Range("P2"), Range("P2").End(xlDown)).Copy '!!!Stops at frist blank!!!
For idx = 1 To 1
Columns("P:P").Cut
Cells(Range("D2").End(xlDown).Row + 1, "D").Select
ActiveSheet.Paste
Next
I'm not seeing why it can't do that. I don't need it to be THIS code if there is some other solution. The task is that I'm changing the layout from one associated information fills a complete row to a "stacked" layout, where associated data (with some blanks) repeats down the column. So the segments are to be stacked. Cut copy pate with the whole columns has been mostly working.
It could copy a range based on the non empty value of another cell prior to moving it. BUT it needs to land on the first empty cell at the bottom of the new range. I'll repeat this for several columns but can do it separately.
I could bypass the first issue if I with some code that would look at the cells in columns BI through BO and fill them with a value ("0" or "-") IF the value in BH is NOT blank.
Your code and question is a little bit confusing but I think this is what you're looking for. this should copy all data from column P including blanks.
Range(Range("P2"), Range("P" & ActiveSheet.Cells(ActiveSheet.Rows.Count, "P").End(xlUp).Row)).Copy

Using Excel to conditionally concatenate multiple rows

I have a large data file that has some broken rows from the extraction process. I'm trying to clean it up in excel and am running into an issue with multiple row checking. I could nest a set amount of IF statements in my formula but that runs the risk of missing values. A Sample of the data looks like this (The strings are pasted into Column A):
'ID_Value','last_name','first_name','','dob','gender'comment
comment
comment
comment'
'ID_Value','last_name','first_name','','dob','gender'comment'
'ID_Value','last_name','first_name','','dob','gender'comment'
'ID_Value','last_name','first_name','','dob','gender'comment
comment
comment
comment
comment'
I need to roll the comment rows into the normal row preceding them. Currently I can identify all the rows and can make it work when there are two comment rows but going beyond that I am at a loss.
Formula in Column B: =IF(LEFT(A1, 1) = "'", "IGNORE", "FLAG")
Formula in Column C: =(IF(B2 = "FLAG", IF(B1 = "FLAG", "MOVE")))
Formula in Column D: =IF(B2 = "FLAG", IF(B1 = "FLAG", IF(C2 = "MOVE", CONCATENATE(A1, A2))))
Any recommendations are greatly appreciated.
Here you go this should do it.
Download the spreadsheet here.
Spreadsheet Example
Paste your data into Sheet 1 Cell A1 and click the run_filter button.
Alternatively you can first run it with the dummy data that already present in Sheet1 and check to see that the results work as expected.
A couple of caveats.
The macro will stop When it encounter a blank cell in Column A. This is how I determine that the macro should end.
Comments should contain no more than 5 commas otherwise they'll be interpreted as real data.
A space character is added to comments.
The first row should not contain a comment.
A new worksheet called Filtered_Result will be created with the required result.
If you want to view the code click on the developer tab.
If it's not present See here for How to add it tab
Then Click the Macro Button.
Click the edit button on the macro combine_comments to see the code.
Give it a try and let me know how it goes.
Peter H

excel sheet sub headings as columns

I am totally new to this kind of challenges and not sure any thing available ( not sure even on what base I have to search )
In the below excel sheet image the column 'A' has headings in two places ( row numbers 2,3 and 9,10) . The actual excel sheet has more than six thousand rows and too many sub headings like this ( If it is small file I can do it manually.. but more than 6 thousand rows)
The challenge :- I want to populate E column with "Make" value and F column with " Model" from sub headings . Can I write any rule or macro to populate these columns ? could some one help me ? Thanks for your help
Image Link
or below
Regards
Kiran
If you want to do this solely in Excel you can use the following. This assumes
All Headings are the same for "S.No"
Change the SUBSTITUTE clause to match the text for Make and Model eg I have used exact spacing of "Model: " and "Make : " to match the spreadsheet and substitute with ""
In cell G5 Enter =IF(ISNUMBER(A5),IF(ISERROR(FIND("Model",A3,1)),MAX($G$1:G4),MAX($G$1:G4)+1),"")
In cell F5 Enter =SUBSTITUTE(IF(ISNUMBER(A5),INDIRECT(ADDRESS(MATCH($G5,$G:$G,0)-2,COLUMN(A1),1)),""),"Model: ","")
In cell E5 Enter = =SUBSTITUTE(IF(ISNUMBER(A5),INDIRECT(ADDRESS(MATCH($G5,$G:$G,0)-3,COLUMN(A1),1)),""),"Make : ","")
Then drag down the formula in E5:G5 to wherever you need. However, I only recommend using this once only as the formulae will be slow to update over large ranges. Also if your headings are out of sync then VBA is the way forward

extract the unique items

Col A,Col B,Col C
Test1,Test1,Test3
Test2,Test1,Test3
Is there a way to go thru all cells and pick out the unique values and place them in a new column or something?
Most of the answers on Getting unique values in Excel by using formulas only only work for values in a single column.
For a solution that works for values in multiple rows and columns, I found the following formula very useful, from http://www.get-digital-help.com/2009/03/16/unique-values-from-multiple-columns-using-array-formulas/
Oscar at get-digital.help.com even goes through it step-by-step and with a visualized example.
1) Give the range of values the label tbl_text
2) Apply the following array formula with CTRL + SHIFT + ENTER, to cell B13 in this case. Change $B$12:B12 to refer to the cell above the cell you enter this formula into.
=INDEX(tbl_text, MIN(IF(COUNTIF($B$12:B12, tbl_text)=0, ROW(tbl_text)-MIN(ROW(tbl_text))+1)), MATCH(0, COUNTIF($B$12:B12, INDEX(tbl_text, MIN(IF(COUNTIF($B$12:B12, tbl_text)=0, ROW(tbl_text)-MIN(ROW(tbl_text))+1)), , 1)), 0), 1)
3) Copy/drag down until you get N/A's.
If you are using Excel 2007 at least, then you can just use Remove Duplicates function from Data tab.
Otherwise I think a little bit of VBA fairy dust sprinkling is in order. I can mash up a quick VBA script if you need it.

Resources