Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Word VBA

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 06-28-2012, 02:41 AM
Jasa P Jasa P is offline Windows XP Office 2007
Novice
 
Join Date: Apr 2012
Posts: 13
Jasa P is on a distinguished road
Default Macro to recap data of same numbers

Hi, I have problem here, I need to recap the data and make it efficient
Would you mind to help me?

For example:
S01=49.41.80.70.30.13.85.49.99.11.74.58.94.32.68.1149.49.94.85.41.30.49x5/15.49.41.99.32.49x60

Becomes


S01=49x140/41x70/30.85.11.94x10/99.32x65/80.70.13.74.58.68x5/15x60

49x140 come from
1. There are 4 of 49 before slash, so 49x5 + 49x5 + 49x5 + 49x5 ---> 49x20
2. There are 2 of 49 after slash, so 49x60 + 49x60 ---> 49x120
Then the recap for 49 ---> 49x140

Same with 41, 30, 85, 11, 94, 99, 32. they are grouped by the same multiplier

Code:
The rules:
First, I want to let you know (x) is multiplication. But, dot (.) is sum

10.20.30x10/ --> the result is 30
235.458.101x25.20/ --> the result is 135
1120.1135x10/ --> the result is 20

So, numbers before (x) is counted by the sum of dot (.)+1 -->(first result)
Number/s after (x) is counted by the sum of numbers between (x) and slash (/) -->(second result)
The final result is multiplication of first and second result

There are 3 ways for possible numbers before (x)
2 numbers/+dot(.), ex: 01 or 45 etc
3 numbers/+dot(.), ex: 245 or 939 etc
4 numbers/+dot(.), ex: 1174 or 8364 etc

Possible sum after (x)
For 2 numbers before (x) --> 1 sum
For 3 numbers before (x) --> 1 or 2 sum
For 4 numbers before (x) --> 1 or 2 or 3 sum
The other examples:
Code:
S01=20?49.41.80.70.30.13.85.49.99.11.74.58.94.32.68.1149.149.49.94.85.41.30.49x20

S02=20?57.75.73.37.43.34.57.75.85.45.74.73.32.68.45.3385.385.85.58.1283.283.83.38.33.38.83.35.53.85.58.61.16.25.57.561.061.61.25x5

S03=20?61.16.10.01.06.60.56.65.15.51.61.25.97.55.54.45.53.35.50.05.70.07.73.37.74.47.75.57.00.03.30.04.40.05.50.16.52.88.24.15.74.02.16.52.55.93.51.39.20.89.55.72.70.07.57.61.16.52.88.172.170.061.561.6874.874.74.47.055.50.61.89x10

I'm using Word 2007, Windows XP for PC, and Windows 7 for notebook
Any help would be great
Thank you

Regards,



Jasa
Reply With Quote
Reply

Tags
macro, recap
Please reply to this thread with any new information or opinions.

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Consolidating data using Macro mrjamez Excel Programming 2 05-22-2012 06:50 AM
Word Macro to get pdf data appended janith Word VBA 1 04-18-2012 12:48 AM
Importing data from excel using a macro soma104 Word 1 04-14-2011 05:10 PM
macro to pull data from multiple files psrs0810 Excel 2 10-25-2010 01:49 PM
How to write a macro to find a specified name in a list of data? Jaffa Excel 1 10-23-2010 02:39 PM


All times are GMT -7. The time now is 03:22 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft