Add new row by looping column (Scripting Dictionary)

SamKhem

Board Regular
Joined
Mar 18, 2024
Messages
50
Office Version
  1. 2016
Platform
  1. Windows
Dear Senior member

I would like request you to guide coding vba with scripting dictionary to run loop in one column to create another row such
Loop column G is reference and F is amount to generate new column with add row in column L and M.

Thank in advance for your assist.
Best regards,
OLDNEW
REFERENCEAMOUNTREFERENCEAMOUNT
PL2308200035-188.28HD2308200035188.28
PL2308200035-188.28
REFERENCEAMOUNT
AC2319900001-100AC2319900001-100
PL2319900001-0.02HD2319900001100
PL2319900001-0.02
HD23199000010.02
REFERENCEAMOUNT
AC2319900009120000AC2319900009120000
ACI23199000091787.8HD2319900009-120000
ACI2319900009114.12ACI23199000091787.8
HD2319900009-1787.8
ACI2319900009114.12
HD2319900009-114.12
REFERENCEAMOUNT
AC2319100027-0.07AC2319100027-0.07
AC23191000270.07PL23191000270.07
AC2319100027100AC2319100027100
PL23191000270.07HD2319100027-100
AC23191000270.07
HD2319100027-0.07
REFERENCEAMOUNT
AC2319100028-0.76AC2319100028-0.76
PL23191000280.76PL23191000280.76
AC23191000281000HD2319100028-1000
AC23191000280.83AC23191000281000
PLF23191000280.05HD2319100028-0.83
AC23191000280.83
HD2319100028-0.83
PLF23191000280.05
REFERENCEAMOUNT
AC231910002910,000.00HD2319100029(10,000.00)
AC231910002923.64AC231910002910,000.00
AC2319100029(21.01)HD2319100029(23.64)
PL231910002921.01AC231910002923.64
ACI23191000291.51AC2319100029(21.01)
PLF23191000290.01PL231910002921.01
HD2319100029(1.51)
ACI23191000291.51
HD2319100029(0.01)
PLF23191000290.01
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
1) Does it matter if the positive or the negative comes first?
2) I don't see a REF: PL2308200035 on the left side. Where did this come from? There are several instances where references on the right-hand side didn't come from the left
3) If there are multiple of instances the same amounts, how do you know which reference to choose from?
 
Upvote 0
1) Does it matter if the positive or the negative comes first?
2) I don't see a REF: PL2308200035 on the left side. Where did this come from? There are several instances where references on the right-hand side didn't come from the left
3) If there are multiple of instances the same amounts, how do you know which reference to choose from?
Dear Cubist
1) Yes for sure, no matter - or + come first.
2) REF: PL2308200035 it just make it only one in column so it will create new columns with 2 rows value as above.
3) Yes I see, so just make left side ref. create to new reference for amount could be skip.
 
Upvote 0
1) Ok,
2) I don't understand I see PL23....35 comes from the OLD, where did HD23...35 come from?
Screen Shot 2024-04-04 at 11.07.18 PM.png
 
Upvote 0
it just create new value with another reference. so if old reference have one (PL......) it will create to new reference in HP.... and PL....
What's the rule for the first 2 characters?
 
Upvote 0
You mean you're not sure? If you're not sure, how would I know?

HP -> PL
What about AC, PLF, ACI, PL -> ???

Are these exhaustive or there are more?
Can't figure out how you're going from OLD to NEW. There are too many inconsistencies. Where is the offset negative for PLF...28?

1712291217772.png
 
Last edited:
Upvote 0
You mean you're not sure? If you're not sure, how would I know?

HP -> PL
What about AC, PLF, ACI, PL -> ???

Are these exhaustive or there are more?
Can't figure out how you're going from OLD to NEW. There are too many inconsistencies. Where is the offset negative for PLF...28?

View attachment 109504
Sorry Sir, as left side (old reference: it could have first 2 characters (AC, ACI, PL, PLF) so when change to new reference it still keep the same just have another one partner with "HP"
 
Upvote 0
You mean you're not sure? If you're not sure, how would I know?

HP -> PL
What about AC, PLF, ACI, PL -> ???

Are these exhaustive or there are more?
Can't figure out how you're going from OLD to NEW. There are too many inconsistencies. Where is the offset negative for PLF...28?

View attachment 109504
HD2319100028
-0.05​
PLF2319100028
0.05​
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,636
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