Find the duplicate values in a column and edit another

Satos

New Member
Joined
Mar 21, 2014
Messages
13
Hi all,

I am trying to find a macro that will find the same entries in Column A and for all of the duplicates except the first one change the value in column T to 0.

I don't want to remove the column because in column A I have the order number and in column T I have the total amount of cart. In many cases we get orders of different products with the same order number, and these unique values in the other columns are needed in my other calculations.

So I would like to change this:

OrderNumber TotalAmountofCart
100001 50
100002 40
100002 40
100003 50
100004 80
100004 80
100005 75

into:

OrderNumber TotalAmountofCart
100001 50
100002 40
100002 0
100003 50
100004 80
100004 0
100005 75

thanks for your help
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Macro not necessary. Assuming in your example "OrderNumber" is in A1, enter this in C2:
=IF(COUNTIF($A$1:A2,A2)>1,0,B2)
Fill down
Copy C2 to the bottom, pastespecial values onto B2, Clear column C.
If you NEED a macro, record these steps.
 
Upvote 0
Copy Cell formula B2 downward...



Excel 2010
ABCD
1Former #'sConverted #'s
2100001 50100001 50Copy and Paste Column B to itself and Repace Column A with the results
3100002 40100002 40
4100002 40100002 0
5100003 50100003 50
6100004 80100004 80
7100004 80100004 0
8100005 75100005 75
Sheet1
Cell Formulas
RangeFormula
B2=IF(LEFT(A1,6)<>LEFT(A2,6),A2,LEFT(A1,6) & " " & 0)
 
Upvote 0
Thank you guys for your help I didn't try to change any value but I made what i wanted by changing the formula that is uses the value in column T.

=IF((IFNA(IF(MATCH(A3;$A$2:A2;0);0;T3);T3))=0;0;(VLOOKUP(P3;'Input Variables'!$A$19:$C$35;2;FALSE)*T3)+VLOOKUP(P3;'Input Variables'!$A$19:$C$35;3;FALSE))

Work perfectly fine.
What do you guys think?
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,322
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top