IF THEN Concatenate AND Cut And Paste

Apr 20, 2006

I have imported .csv files into a workbook and there are instances where the data did not separate properly. When this happens, part of the text (an MCI circuit ID) that should be in column A, ends up in column B. This obviously moves the data that should be in B:I to C:J. I have the code below, which, when "*MCI*" is found in a cell in column B (and as extra validation), a "0" is found in column J, the text in column B is joined with the text in column A. This works fine. What I need is to also have it delete the circuit ID that still exists in column B and then cut the data in C:J and paste it in B:I.

If it matters, there could be as many as 25,000 rows.

Sub IfMCIexists()
Dim a As Long
Dim b As Long
Dim i As Long
Dim j As Long
Dim r As Long
Dim lr As Long

'Fancy report headings in rows 1 thru 7, so start at Row 8
r = 8

'Column in which text will be combined if conditions are met A (1)
a = 1

'Search Column B for condition one (if *MCI* exists)
b = 2

'Search Column J for condition two (if "0" exists)
j = 10

'Determine last row containing data
lr = Cells(65536, b).End(xlUp).Row

'Loop and concatenate if "*MCI*" is found in column B and "0" is found in column J

For i = 8 To lr
If Cells(r, b).Text Like "*MCI*" And Cells(r, j).Value = "0" Then Cells(r, a) = Cells(r, a) & Cells(r, b)
r = r + 1
Next i
End Sub

View 4 Replies


ADVERTISEMENT

Concatenate & Paste Visible Cells

Dec 11, 2007

After a filter is applied I wish to achieve the following:

Concatenate the contents of the visible cells in columns B2 (down) & C2 (down) and paste to A38 in a sheet called Stats.

Paste the visible cells in D2 (down) to B38 in a sheet called Stats.

View 4 Replies View Related

Concatenate Duplicates: Concatenate Results Of All Equal P/N's From Any Given List

Oct 6, 2007

I have a list of P/N's that are used in more then one location. and it's sorted by P/N's.

ColA__ColB__ColC
______Loc___PN
______1_____A
______2_____A
______3_____B
______4_____C
______5_____C

I Want to be able to put in Col A the concatenate results of all equal P/N's from any given list. Or at least select the few cells that i know are duplicates and from that copy the Location to a single Column.

ColA ColB__ColC
______Loc__PN
1,2____1___A
_______2___A
_______3___B
4,5____4___C
_______5___C

View 5 Replies View Related

Concatenate Non Blank Cells But Use Concatenate And Substitute Instead Of IF

Aug 11, 2013

Sampling table :

one
two
three
four
one
two
three
one
two
one

Desired results obtained via IF =IF(B2>0,A2&" , ",A2)&IF(C2>0,B2&" , ",B2)&IF(D2>0,C2&" , ",C2)&IF(D2>0,D2,"")

one , two , three , four
one , two , three
one , two
one

Is there any smarter, shorter formula via Concatenate and Substitute or other formulas ?

My closest match, but not good enaugh is =SUBSTITUTE(CONCATENATE(A2&", "&B2&", "&C2&", "&D2), ", , ", " ")
[ returna 2 commad ]
one, two, three, four
one, two, three,
one, two
one ,

View 9 Replies View Related

Prevent Copy / Paste Cells With Comments Or Allow Paste But Do Not Paste Comments

Feb 4, 2014

How would you prevent the copy/paste of cells that have comments?

Also, how would you allow cells with comments to be copied and pasted without pasting the comments?

I also have an aside question about the forum advanced search. When searching for multiple search words, how would you type the search to include all words, for example, "prevent" & "paste" & "comments".

View 7 Replies View Related

Paste Unique Values (paste In Active Cell Copied Range)

Jun 4, 2009

i try to paste in active cell copied range.

I mean that i do follow:
- i select range of cell - mostly range of column f.e. A2:A500
- i click/select on any free cell (f.e. B1)
- then i run macro

i expected it paste unique values (text or number)

this dont work

i dont know how defined the range

View 14 Replies View Related

Copy / Paste Certain Cells Then Paste 3 Sheets Into New Workbook - VBA 1044 Error?

Feb 3, 2012

This macro works fine on my machine but not with other users:

This should copy/paste certain cells then paste 3 sheets into a new work book.

ON other computers it seems to paste in a picture? works OK for me?

Sub ValidationTests()
'
' ValidationTests Macro
' Macro recorded 21/12/2011 by '
'
Sheets("Score Sheet").Select
Range("A8:M18").Select
Range("H18").Activate
Selection.Copy

[Code] ..........

View 1 Replies View Related

Excel Macro To Copy Data From Array And Paste To Separate Sheet Paste Special Transpose

Jan 29, 2014

I would like to implement specific cell ranges from two specific worksheets each within 33 workbooks (which all have several tabs) into a summary page in a separate workbook.

The cell ranges are going across my spreadsheet in rows and I would like for them to transpose into a columns depending on the data which I have separated by catergory on the summary page. They are all on the same location in each workbook which is separated by country. The cell ranges are E26:P37 and I would like to transpose them and have them put below eachother without overwriting for my format on the summary page, how I can put this together in a macro?

View 1 Replies View Related

Simple Copy Sheet Paste In Other Book But Paste Values?

Jun 20, 2013

Attached is my code, pay attention to the bold part. I want the sourceSheet to be copied as a sheet and pasted in the targetSheet (the Sheet2 of "NewBook") but I want it pasted asvalues. Here is the specific part which needs to be looked at...and below is the full code.

VB:
Set sourceBook = Application.Workbooks.Open(sourceFilename)
Set sourceSheet = sourceBook.Sheets("Current")
Set targetSheet = NewBook.Sheets("Sheet2")

[Code].....

View 9 Replies View Related

Copy / Paste Every Sheet Single (P Column) And Paste To Notepad

Sep 6, 2012

copy/paste Every Sheet Single ( P Column ) and Paste to Notepad and take P1 As file name for note pad.

View 1 Replies View Related

Create Macro That Can Copy / Paste Or Cut / Paste Rows Into Different Spreadsheet

Oct 1, 2012

I have one workbook that needs two macros.

On the "Complete Backlog" tab of my workbook, I want users to enter in the requested information based on the column header. Then I would like a Macro attached to a button that says "Refresh" that the user would click after they have entered in all of the information. This macro should look in Column M (WIP Status) and if any of the cells say "Close", it should Cut the entire row from the spreadsheet(Ex. A2:M2) and Paste it into the speadsheet titled "Closed Jobs".

This is so that as jobs are closed/finished, they are removed and stored on a separate sheet. The items would have to be pasted so that it pastes into the next available row - not just on top of each other.

I also need another macro that i can put into a button that doesn't "delete" a row from the sheet, but just copies over to another sheet - so that there are two instances in the workbook.

If would look something like: If a cell in "Column G / Director" of the "Complete Backlog" speadsheet is equal to "Snodgress" then copy columns A-L of the same row to the spreadsheet titled "Snodgress" - of course skipping down the rows to the next blank row.

.....is equal to "Herr" copy row to "Herr" spreadsheet.
....is equal to "McCormick" copy row to "McCormick" spreadsheet.
and so on.

View 2 Replies View Related

Copy And Paste Without Disturbing Existing Data In Paste Area

Nov 25, 2012

HTML Code:

Range Apple
A B C D E
1 2 2 4 3
2 1 3 5
3 4 6 9
4 5 3 1 3
5 7 7 7 6

Range Pear
A B C D E
4 1 3 5
5 1 1 1
6 2
7 2 2
8 5 7

Range Apple
A B C D E
1 2 2 4 3
2 1 3 5
3 4 6 9
4 5 3 1 3
5 7 7 7 6

View 2 Replies View Related

Opposite Of Concatenate

Sep 29, 2006

I have 2,000+ cells containing text that I need to break out into multiple cells. They are names (ex. John M Smith MD) and I need each part of the name in it's own column. I need the opposite of concatenate.

View 3 Replies View Related

Concatenate (two Different Cells Into One)

Dec 11, 2008

I'm having a rather difficult time getting this one.

I am concatenating (is that a verb?) a bunch of cells to create an item code.
The combination of two different cells need to be able to give different values so I can dump the appropriate value into the CONCATENATE formula.

A picture is worth a thousand..

View 4 Replies View Related

Concatenate The Dropdown

Jun 19, 2009

I am trying to get 2 rows in one drop down without having to create another combined row. im not sure what formula should i use. I have attached an example.

View 7 Replies View Related

Increment Using Concatenate

Sep 2, 2009

I want to write formula in cells(many cells!) using concatenate. The desired output:

In Sheet2!D1 - i will write concatenate of Sheet1!C6 and Sheet1F6
in Sheet2!E1 - i will write concatenate of Sheet1!C7 and Sheet1F7
in Sheet2!F1 - i will write concatenate of Sheet1!C8 and Sheet1F

Copy and paste formula would not do so i created a macro stated below. The problem is a can not change the ActiveCell.Formula correction.

View 2 Replies View Related

Variable With Concatenate

Jan 2, 2013

I have a simple task and I use the concatenate formula to resolve alot of keystrokes. I now have an issue where I have to edit that formula because of a additional character for the string won't upload into a database. Here's my example:

1. Cell A1= 12345xxxx Cell B1= 67 Cell C1= 8

I use =CONCATENATE(A1,"-000"&B1,"-000"&C1) and my result is displayed in D1= 12345xxxx-00067-0008

Easy enough! Now adding the following is the problem:

1. Cell A2= 12345 Cell B2= 67 Cell C2= 89

I use =CONCATENATE(A2,"-000"&B2,"-000"&C2) and my result is displayed in D2= 12345xxxx-00067-00089

Now D2 has one too many characters from C2

I modify the formula by reducing to "-000"&C2 to be "-00"&C2 manually but now the line items have quadrupled and manually isn't going to work for this being so time consuming.

Is there a way to use a variable with the concatenate or am I using the wrong formula period ??

View 3 Replies View Related

Automatic Concatenate

Jul 9, 2009

A1 contains "=2+3+4" which shows 8 as a result. I would like to add a word "Lbs" with it so it would display "8 Lbs" on the same cell. If I entered =1+2+3 on cell A6000, it should give me "6 Lbs".

View 7 Replies View Related

VBA Concatenate Formula

Jul 25, 2009

I'm trying to use a macro to write a formula within a column of data.

Here's the

View 3 Replies View Related

Concatenate 2 Column

Feb 2, 2010

i trying to merge column A1 (ABC) with column B1(XYZ), B2(LOL), B3(ROF) ..etc

with a simple =CONCATENATE(A1,"-",B1) , i can get "ABC-XYZ" , but when come to column B2 , i only can get "-LOL" , any solution ?

View 4 Replies View Related

CONCATENATE Not Working

Nov 2, 2006

Create a column of concatenated values to serve as a "primary key" for a compare and merge tool (Synkronizer). For some reason, the CONCATENATE function isn't being recognized.

If I enter
=CONCATENATE(A2,B2)
instead of showing the strings located in A2 and B2 it displays
=CONCATENATE(A2,B2)
in the cell.

I tried creating a new spreadsheet and it works just fine. Does anyone have an idea of what might be happening? I have compared all of the options between the two spreadsheets and don't see any difference in them.

View 9 Replies View Related

If / Concatenate Into One Cell

Nov 14, 2008

I have 6 columns:

A1 = LastName
B1 = FirstName
C1 = LastName2
D1 = FirstName2

I need to concatenate into 1 cell so it looks like this: FirstName LastName;FirstName2 Last Name2. Now the challenge is that there are many instances where C1 and D1 are blank (don't have values).

So here was my attempt at a formula:
=IF(A1>""&B1>"",CONCATENATE(B1," ",A1))& IF(C1>""&D1>"",CONCATENATE(";"&D1,"",C1),"")

Now this works, but it ALWAYS leaves a semi colon at the end (even when there is no C1 and D1 to concatentate. Thus I put in my IF statement the "".

View 4 Replies View Related

Concatenate Function..

Jan 23, 2010

What function can get me the first letter from the first name and the whole last name together and then add @email.com. Example: Hanry Jones = HJones@email.com

View 2 Replies View Related

Concatenate Returning Zero

Dec 20, 2011

I have this code

Code:
Selection.FormulaR1C1Local = "=INDIRECT(CONCATENATE(""["",R4C26,""]Sheet1!"",RC))"

Which creates this in the excel cell:
=INDIRECT(CONCATENATE("[",$Z$4,"]Sheet1!",D4))

But for some reason, it returns a 0. However, when I change the code in the excel cell to this
=INDIRECT(CONCATENATE("[",$Z$4,"]Sheet1!D4"))

It works. But I need to be able to change D4 in the macro, so doing it that way won't work for me.

View 7 Replies View Related

How To Concatenate Columns

May 16, 2012

I have the below set of data for example,

aaabbbcccdddeeeaaabbbaaabbbcccaaa

I need the output as,

aaabbbcccdddeeeaaabbbaaabbbcccaaa

As we know, a simple concatenate will work. But my columns are not limited and not easily countable. In my real scenario for some of the rows, data exist from column "A" till column "IB". So, I need to first identify the column data exist in each row and then to implement the concatenate function.

View 3 Replies View Related

How To Concatenate Two Arrays

Jul 24, 2012

Currently I am trying to concatenate two arrays stockotherarray and stockfittingsarray to create stockarraynew

Below is my code, I keep receiving a compile error.

Sub stockarraynew()
stockarraynew() = Split(Join(stockotherarray & Join(stockfittingsarray))
End Function

View 9 Replies View Related

Concatenate 3 Columns Into One

Jul 30, 2012

I'm trying to take the contents of 3 columns- A, B & C and have them form what I can use for a search string in column

D that I can use in a database I have.
Column A is first name
Column B is last name
Column C is Company Name

This is what i'm trying to get it to look like in column d:

("First Name Last Name" OR "FirstName.LastName") AND @companyname.com

View 6 Replies View Related

Concatenate Several Cells On Tab One

Apr 11, 2013

On tab 2 of a spreadsheet, I am trying to concatenate several cells on tab one! Everything comes together in the cell on tab 2, however it does not hold the date format. It turns it into general text so just random numbers that do not even tie to the date. Any way to lock the date format for this idea?

View 7 Replies View Related

Concatenate A List

Mar 3, 2007

I have a list containing 3 the abbreviations of states in A1:A3 (one in each cell), and I would like to concatenate the list in cell B1 to display the list like this: "CA, TX, FL". At times, the list will only have one state (always in A1), but at other times it may have 2 or 3.

I tried: =IF(ISTEXT(A),A1&", "&A2&", "&A3,A1)

But, if A2 does not list a state then it returns "#value!"; and if A2 lists a state but A3 does not then it returns only the value in A1.

What can I do to get it to list all states listed in column A whether there are 1, 2, or 3 states listed?

View 9 Replies View Related

Concatenate Cells With % In Them

Apr 27, 2007

I have 7 consecutive cells which contain a %
e.g. A1 120%, B1 35% etc

I am trying to put them into one cell using concatenate
but am getting 1.20.3529411764705880.705882352941177

I would also like to separate them by comma,

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved