Conditional Quantity sum based on duplicate values in various other columns

whassan

New Member
Joined
Dec 10, 2015
Messages
25
Office Version
  1. 2010
Platform
  1. Windows
Hi All,
I have an Excel file name "Security macro.xlsm". There are 11 columns on sheet1 of this excel file.
User enters a new record manually, in column A, C, D, E, F, G, H, I, J and K.
Column B, values in this column "Security ID number" are already populated.
I am looking for a VBA solution to achieve that when user enters a new record, run that VBA code and if the new values in column E, H, I, J and K match existing data in the same columns, it will automatically add a new line under the existing record, cut values in column A, C, D, E, F, G, H, I, J and K and paste them in the new line and then sum the "Quantity" and show the sum on additional new line.
I have provided examples of both the original data and how the data should appear after running VBA code.
Could someone kindly help?


Example of ORIGINAL DATA
System refSecurity ID NumberCLIENT/CPTYQuantityCCYDeal dateSett. DateMaturity DateRateSecurity TypeInstrument
12345678GB6341659900Client 1100,000,000.00GBP
28-Apr-23​
03-May-23​
05-Jul-234.47Non-DiscountedA
12345679GB6341659901Client 2100,000,000.00EUR
28-Apr-23​
03-May-23​
10-Jul-233.21DiscountedA
12345680GB6341659902Client 120,000,000.00EUR
28-Apr-23​
03-May-23​
01-Jun-233.18DiscountedB
12345681GB6341659903Client 450,000,000.00EUR
28-Apr-23​
03-May-23​
03-Aug-233.415DiscountedB
12345682GB6341659904Client 5130,000,000.00GBP
28-Apr-23​
03-May-23​
03-Aug-234.705DiscountedB
12345683GB6341659905Client 650,000,000.00EUR
02-May-23​
04-May-23​
02-Aug-233.405DiscountedB
12345684GB6341659906Client 730,000,000.00GBP
02-May-23​
04-May-23​
05-Jul-234.47Non-DiscountedA
12345685GB6341659907Client 873,610,000.00USD
02-May-23​
03-May-23​
15-Jun-235.16DiscountedA
12345686GB6341659908Client 9100,000,000.00EUR
02-May-23​
03-May-23​
05-Jun-233.205DiscountedB
12345687GB6341659909Client 1065,000,000.00EUR
02-May-23​
04-May-23​
05-Jun-233.225DiscountedB
12345688GB6341659910Client 1150,000,000.00EUR
02-May-23​
04-May-23​
04-Aug-233.425DiscountedB

Example of data below, should appearing after running VBA code.
System refSecurity ID NumberCLIENT/CPTYQuantityCCYDeal dateSett. DateMaturity DateRateSecurity TypeInstrument
12345678GB6341659900Client 1100,000,000.00GBP
28-Apr-23​
03-May-23​
05-Jul-234.47Non-DiscountedA
12345684Client 730,000,000.00GBP
02-May-23​
04-May-23​
05-Jul-234.47Non-DiscountedA
130,000,000.00
12345679GB6341659901Client 2100,000,000.00EUR
28-Apr-23​
03-May-23​
10-Jul-233.21DiscountedA
12345680GB6341659902Client 120,000,000.00EUR
28-Apr-23​
03-May-23​
01-Jun-233.18DiscountedB
12345681GB6341659903Client 450,000,000.00EUR
28-Apr-23​
03-May-23​
03-Aug-233.415DiscountedB
12345682GB6341659904Client 5130,000,000.00GBP
28-Apr-23​
03-May-23​
03-Aug-234.705DiscountedB
12345683GB6341659905Client 650,000,000.00EUR
02-May-23​
04-May-23​
02-Aug-233.405DiscountedB
12345684GB6341659906Client 730,000,000.00GBP
02-May-23​
04-May-23​
05-Jul-234.47Non-DiscountedA
12345685GB6341659907Client 873,610,000.00USD
02-May-23​
03-May-23​
15-Jun-235.16DiscountedA
12345686GB6341659908Client 9100,000,000.00EUR
02-May-23​
03-May-23​
05-Jun-233.205DiscountedB
12345687GB6341659909Client 1065,000,000.00EUR
02-May-23​
04-May-23​
05-Jun-233.225DiscountedB
12345688GB6341659910Client 1150,000,000.00EUR
02-May-23​
04-May-23​
04-Aug-233.425DiscountedB
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
I have the following Works sheet
ISIN macro (working bulk ISIN).xlsm
ABCDEFGHIJK
1OBS REFISINCLIENT/CPTY FMT CCYTDSDMDInterest RateDisc. / Non Disc.Product
212345678 SP6341659900 Customer 110,000,000.00GBP28-Apr-2303-May-2305-Jun-234.47Non-DiscountedAB
312345679 SP6341660916 Customer 212,000,000.00EUR28-Apr-2303-May-2305-Jun-233.21DiscountedAB
412345680 SP6341661922 Customer 314,000,000.00EUR28-Apr-2303-May-2301-Jun-233.18DiscountedCD
512345681 SP6341662938 Customer 416,000,000.00EUR28-Apr-2303-May-2303-Aug-233.415DiscountedCD
612345682 SP6341663944 Customer 118,000,000.00GBP28-Apr-2303-May-2303-Aug-234.705DiscountedCD
712345683 SP6341664959 Customer 620,000,000.00EUR02-May-2304-May-2302-Aug-233.405DiscountedCD
812345684 SP6341665964 Customer 722,000,000.00EUR02-May-2304-May-2304-Aug-233.425DiscountedCD
912345685 SP6341666970 Customer 824,000,000.00USD02-May-2303-May-2315-Jun-235.16DiscountedAB
1012345686 SP6341667010 Customer 326,000,000.00EUR02-May-2303-May-2305-Jun-233.205DiscountedCD
1112345687 SP6341668026 Customer 1028,000,000.00EUR02-May-2304-May-2305-Jun-233.225DiscountedCD
1212345688 SP6341669032 Customer 1130,000,000.00EUR02-May-2304-May-2304-Aug-233.425DiscountedCD
1312345689 SP6341670048 Customer 1232,000,000.00EUR02-May-2304-May-2305-Jun-233.22DiscountedAB
1412345690 SP6341671053 Customer 734,000,000.00EUR02-May-2304-May-2304-Aug-233.435DiscountedAB
1512345691 SP6341672069 Customer 1436,000,000.00EUR03-May-2305-May-2307-Aug-233.435DiscountedCD
1612345692 SP6342968417 Customer 1538,000,000.00GBP03-May-2304-May-2304-Aug-234.71DiscountedAB
1712345693 SP6342969423 Customer 1640,000,000.00GBP03-May-2305-May-2305-Jul-234.615DiscountedAB
1812345694 SP6342970439 Customer 242,000,000.00GBP03-May-2305-May-2305-Jul-234.62Non-DiscountedAB
1912345695 SP6342971445 Customer 1844,000,000.00EUR03-May-2305-May-2305-Jun-233.23DiscountedAB
2012345696 SP6342972450 Customer 846,000,000.00USD03-May-2308-May-2308-Aug-235.33DiscountedCD
2112345697 SP6342973466 Customer 2048,000,000.00GBP03-May-2305-May-2305-Jul-234.61DiscountedAB
2212345698 SP6342974472 Customer 2150,000,000.00GBP03-May-2305-May-2305-Sep-234.78Non-DiscountedAB
2312345699 SP6342975487 Customer 1452,000,000.00GBP04-May-2309-May-2309-Jun-234.515DiscountedAB
2412345700 SP6342976493 Customer 1854,000,000.00EUR04-May-2309-May-2302-Aug-233.385DiscountedAB
2512345701 SP6342977509 Customer 2456,000,000.00EUR04-May-2309-May-2309-Jun-233.24DiscountedAB
2612345702 SP6342978515 Customer 2558,000,000.00EUR04-May-2309-May-2309-Jun-233.235DiscountedCD
2712345703 SP6342979521 Customer 2660,000,000.00EUR04-May-2309-May-2308-Jun-233.24DiscountedAB
28 SP6342980537
29 SP6342981543
30 SP6342982558
31 SP6342983564
32 SP6342984570
33 SP6342985585
34 SP6342986591
35 SP6342987607
36 SP6342988613
37 SP6342989629
38 SP6342990635
39 SP6342991641
40 SP6342992656
41 SP6342993662
42 SP6342994678
43 SP6342995683
44 SP6342996699
45 SP6342997705
46 SP6342998711
47 SP6342999727
48 SP6343000731
49 SP6343001747
50 SP6343002752
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B16:B215Cell ValueduplicatestextNO
B16:B215Cell ValueduplicatestextNO
B2:B15Cell ValueduplicatestextNO
B2:B15Cell ValueduplicatestextNO
B251:B1048576,B1Cell ValueduplicatestextNO
B251:B1048576,B1Cell ValueduplicatestextNO
Cells with Data Validation
CellAllowCriteria
C1List=$AG$15:$AG$54
C2:C1048576List=$S$2:$S$214
A2:A50Custom=COUNTIF($A$2:$A$400,A2)=1
J2:J50List=$R$2:$R$3
K2List=$Q$2:$Q$3
 
Upvote 0
Hi,
I have tried to search for a solution to my problem online but have not been successful so far. I kindly request someone to assist me. If I am not clear in asking what I need or have not presented my data in the desired format, please guide me accordingly.Thank you for your help.
 
Upvote 0
Hi,
I am wondering if there is anyone who might be able to assist me, or should I assume that my issue will go unresolved and refrain from seeking further help?
 
Upvote 0

Forum statistics

Threads
1,223,954
Messages
6,175,603
Members
452,660
Latest member
Zatman

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