Condition breakdown

Mac1206

Board Regular
Joined
Jun 3, 2016
Messages
184
I have this COND column in Excel which I need to import into Access but as you see, each row has this long string that needs to be converted into rows: Sold to party, Price Group and Shipping Condition would need to be represented 5 times for this particular Price Group....I'm at a lost trying to convert this....Thanks in Advance

Sold to party = 100092131 And Price Group = 27 And Shipping condition = RR And Price Group Includes 19,22,25,27,29

<tbody>
</tbody>
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
This is very weird. Can you explain more? In database design generally you do not import conditions as columns in tables - you use conditions to select from columns in tables!
 
Upvote 0
This is very weird. Can you explain more? In database design generally you do not import conditions as columns in tables - you use conditions to select from columns in tables!

You are correct, I'm trying to import an excel file that has a Condition column which need to be converted into fields and rows...My row J2 is this one line : Sold to party = 100092131 And Price Group = 27 And Shipping condition = RR And Price Group Includes 19,22,25,27,29

In order for me to import into access, it need to be converted somehow into this format as column and rows below:


SOLD TO PARTY PRICE GROUP SHIPPING CONDITION PRICE GROUP INCLUDES
10009213127 RR 19
10009213127 RR 22
10009213127 RR 25
10009213127 RR 27
10009213127 RR 29

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>


May this is a VBA or Excel formulas functionality that could convert this into the right format for importing instead of a manual process for several thousand records...
 
Upvote 0
How did you end up with such a strange data set? Are you trying to reverse engineer something?
 
Upvote 0
How did you end up with such a strange data set? Are you trying to reverse engineer something?

It came as an Excel file, which is weird indeed as such (Sample Data):

RULE_IDSTART_DATEEND_DATENAMECOMPONENTCOMPONENTVALCURRENCYUOMCOND
1338/27/2008CW Carry Rail Direct Discount W,NDISCOUNT.5CADCWT Sold to party = 100092131 And Price Group = 27 And Shipping condition = RR And Price Group Includes 19,22,25,27,29

<colgroup><col><col><col><col><col><col><col><col><col></colgroup><tbody>
</tbody>
The desired result is:

RULE_IDSTART_DATEEND_DATENAMECOMPONENTCOMPONENTVALCURRENCYUOM SOLD TO PARTY PRICE GROUP SHIPPING CONDITION PRICE GROUP INCLUDES
1338/27/2008CW Carry Rail Direct Discount W,NDISCOUNT.5CADCWT10009213127 RR 19
1338/27/2008CW Carry Rail Direct Discount W,NDISCOUNT.5CADCWT10009213127 RR 22
1338/27/2008CW Carry Rail Direct Discount W,NDISCOUNT.5CADCWT10009213127 RR 25
1338/27/2008CW Carry Rail Direct Discount W,NDISCOUNT.5CADCWT10009213127 RR 27
1338/27/2008CW Carry Rail Direct Discount W,NDISCOUNT.5CADCWT10009213127 RR 29

<colgroup><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><tbody>
</tbody>
Is there anyway to convert that last column so it would pull out the fields and what it equals?
 
Upvote 0
Okay but why would you assume this:
Code:
100092131 	27 	RR 	19
100092131 	27 	RR 	22
100092131 	27 	RR 	25
100092131 	27 	RR 	27
100092131 	27 	RR 	29
instead of this:
Code:
100092131 	27 	RR 	27

which is to say, just because 27 is included in 19,22,25,27 and 29 doesn't mean 27 is 19,22,25,27 and 29 ... it could be just itself (27).

what you are asking for requires some fairly heavy duty data massaging. There is no button to press for that. It remains quite mysterious how you are interpreting this COND column and why the data is coming to you that way.
 
Last edited:
Upvote 0
Okay but why would you assume this:
Code:
100092131     27     RR     19
100092131     27     RR     22
100092131     27     RR     25
100092131     27     RR     27
100092131     27     RR     29
instead of this:
Code:
100092131     27     RR     27

which is to say, just because 27 is included in 19,22,25,27 and 29 doesn't mean 27 is 19,22,25,27 and 29 ... it could be just itself (27).

what you are asking for requires some fairly heavy duty data massaging. There is no button to press for that. It remains quite mysterious how you are interpreting this COND column and why the data is coming to you that way.

I understand but that's my directive to see if it can be done with this excel file and you are correct with 100092131 27 RR 27...
 
Upvote 0
okay. Do you have any examples of more COND values or do they all follow exactly this kind of structure? For instance, they can probably be split out on the AND values and the = symbols, but that means they must all have the same conditions applied. If they don't, it's even uglier (such as rows that don't have the includes condition or rows that don't have the shipping condition condition).

Approx. how much data is there (not a big deal but 1,000,000 rows would be a lot different than 1,000 rows in terms of building a solution).
 
Last edited:
Upvote 0
okay. Do you have any examples of more COND values or do they all follow exactly this kind of structure? For instance, they can probably be split out on the AND values and the = symbols, but that means they must all have the same conditions applied. If they don't, it's even uglier (such as rows that don't have the includes condition or rows that don't have the shipping condition condition).

Approx. how much data is there (not a big deal but 1,000,000 rows would be a lot different than 1,000 rows in terms of building a solution).

About 125,000 and the condition is the same...Thanks in advance
 
Upvote 0
About 125,000 and the condition is the same...Thanks in advance
Good morning Xenou, I had to verify that the code layout above and for each price within the group, it is assigned as follows:

Desired Result Code:
100092131 27 RR 19
100092131 27 RR 22
100092131 27 RR 25
100092131 27 RR 27
100092131 27 RR 29

I hope this doesn't make it more difficult but I know this type of programming is difficult anyway....I'm learning that...
 
Upvote 0

Forum statistics

Threads
1,215,197
Messages
6,123,581
Members
449,108
Latest member
rache47

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