Copy duplicate rows from 2 columns Excel VBA - excel

I have a worksheet with 3 columns (A,B,C).
I want to check for duplicates between column A and C
If a cell value in A matches a cell value in C then I want to copy B in that row to another location (let's say column E).
The cells are located in different rows on columns A and C.
The copy from B column needs to be on the same row as the duplicate on A, not on C.
How can I do this with Excel VBA?
Thanks a lot!

Perhaps you can use a formula like:
=IF(COUNTIF(C:C,A1)>0,B1,"")
It should give you what you want. Put that in column E, and copy it down for what you need.

Related

Compare column A sheet 1 and compare column B sheet 2 and if duplicate found, copy and return value on column B sheet 1 from column C sheet 2?

I am looking for a formula -
Compare column A sheet 1 and compare column B sheet 2 and if duplicate found, copy and return value on column B sheet 1 from column C sheet 2?
Hope that make sense.
Thanks is advance.
A Classic INDEX/MATCH
In e.g. cell B2 of Sheet1 use:
=IFERROR(INDEX(Sheet2!$C:$C,MATCH($A2,Sheet2!$B:$B,0)),"")
and copy down.
It is actually the same as the inferior:
=IFERROR(VLOOKUP($A2,Sheet2!$B:$C,2,FALSE),"")
Possibly you want to restrict it to something like
=IFERROR(INDEX(Sheet2!$C$2:$C$101,MATCH($A2,Sheet2!$B$2:$B$101,0)),"")

How to move data from one column to another without overwriting existing values in destination column

I'm hoping this is so simple I'm just over-looking the obvious answer! I want to move the values (pictured) in column A, en-masse, to the blank cells in column B without overwriting the existing values in column B. Note that the data in column B has differing number of rows. Any ideas?
enter image description here
There are a couple of options to do this:
Option 1
Place a filter onto the data
Filter column B for blank values
Enter a formula into B1 that is =A1
Drag this down to the bottom of your cells
Set the filter for all values
Select the whole of column B
Copy and Paste the data as values
Option 2
Create a new column after B
In this column enter the following formula - =IF(B1="",A1,B1)
Drag this down to the bottom of your data
Select the whole of column B
Copy and Paste the data as values
Delete column B
Column C then becomes column B
I knew I was missing something...Copy Column A, highlight column B, 'Paste special', tick 'Skip blanks' checkbox and done! Many thanks for reading.

Concatenate multiple rows of Column B until column A contains X then, loop again

enter image description here
I need to do this in excel and I do know how to do this with python etc, but it has to be done in excel either VBA or formula (best option).
Column A, contains a "W" character.
Column B, contains a "abc" cell that will be the same everywhere (The other rows won't be the same).
Column C, I am concatenating all cells in column B before column A hits a "W" value.
I want to achieve some sort of a formula in a single or multiple steps that will allow me to concatenate all B column rows until column A has a "W". The concatenation must happen in same row as "abc" in column B, but paste on column C.
Thank you in advance
If you can use column D (as an intermediate step) as well as C, set C2 to
=IF(A2="W",D2,"")
and set D2 to
=B2&IF(A3="W","",";;"&D3)
then copy column C and D down as far as necessary.

Sorting one column based on another one in excel

How do I get column E to skip rows where there no duplicate in column A.
Instead of trying to figure out how to insert blank rows in Column E and F where there is a missing value based on A... use a Vlookup() in Column D to grab the relevant pieces from Column F:
Assuming your data starts on A16 according to your picture, in D16 enter:
=Vlookup(A16, E:F, 2, False)
And copy that down. Now you will have Column F values in their appropriate rows in Column D.

Excel copy cell A to cell C if cell B duplicate

I have two columns in excel with column A is a numbers and column B is a duplicate of various texts.
I need a way to copy the column A to column C if column B is duplicate?
If you are simply trying to indicate duplicates, would this work for your case (formula goes in C2)?
=IF(COUNTIF(B:B,B2)>1,A2,"")
Work on a copy, with data headers assumed to be in row 1.
Sort data by column B.
In C2, type =IF(B2=B1,A1,"")
and copy down the sheet.
Then, if there's a duplicate, it will appear in column C

Resources