Solved

Excel VBA data concatenation

Posted on 2013-10-24
20
324 Views
Last Modified: 2013-11-20
Hi,
  I would like to get assistance with VBA coding to perform data concatenation in an Excel spread sheet.
Please see the attached file for problem statement and screen shots. Please let me know if you need more clarification or have any

questions.

Thanks in advance.
EE-Data-concatenation.docx
0
Comment
Question by:tesla764
  • 11
  • 7
20 Comments
 

Author Comment

by:tesla764
ID: 39597564
Basic logic flow...
Check row 3 - Find cell that has Green fill color.
Next column
  if row 3 cell is not Green then
  check row 4 for "Regulatory"
  When "Regulatory" is found
    copy (concatenate) the value in that column data to the column to the left (Column with Green fill in row 3), that has the word "Regulatory"
This concatenation will take plae until the Green fill color is encountered (row 3)
0
 
LVL 32

Assisted Solution

by:Robberbaron (robr)
Robberbaron (robr) earned 480 total points
ID: 39600216
1. so you will have lots of columns to process ?  eg beyond Z

2. And only one row or a number of rows as well ?

3. do you want this to happen as you change cells or is it ok to have a button <Update Now>

please post a test workbook rather than word screenshots.
0
 
LVL 15

Assisted Solution

by:weinberk
weinberk earned 20 total points
ID: 39601369
I also agree, please post an excel sheet.  Your description isn't particularly clear.  Seeing the actual xlsx document will help for sure.
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

Author Comment

by:tesla764
ID: 39605501
0
 

Author Comment

by:tesla764
ID: 39605510
If you put all 3 attached files in c:\temp this should work.
DRA-PDS-Audit.accdb
0
 

Author Comment

by:tesla764
ID: 39605730
Workbook and db files have been provided. Do they work alright for you?
0
 
LVL 32

Assisted Solution

by:Robberbaron (robr)
Robberbaron (robr) earned 480 total points
ID: 39608273
had to make some changes to the hardcoded paths but get it to open.

do you need the function to occur upon workbook open like the other code or by a button on the sheet.  I'll attempt the later as should be able to be independent of startup.
0
 

Author Comment

by:tesla764
ID: 39608527
That's fine.
0
 
LVL 32

Assisted Solution

by:Robberbaron (robr)
Robberbaron (robr) earned 480 total points
ID: 39611253
I cant get the Country recordset to populate.... no ISAM yet the question list does.

so i cant get any data to match your example..

can you save the example in the doc file as values only ?

copy all the cells on the sheet and then paste-as-values to a new sheet.
0
 
LVL 32

Assisted Solution

by:Robberbaron (robr)
Robberbaron (robr) earned 480 total points
ID: 39611275
is AggregateColumnValues the function you want extended ?

it seems to be joining cells based upon color.
0
 
LVL 32

Accepted Solution

by:
Robberbaron (robr) earned 480 total points
ID: 39611289
please check my logic...

start at row 3, Column B.  (cellStart)
   find the next cell in Row 3 that has green background. RGB(220, 230, 241) (cellEnd)
      start a new dataConcatenation=""

      for each [i]cellX [/i]in Row 4 up to cellEnd
           if cellX is not part of the cellStart columnspan (coloured) then 
                if cellX value is "Regulatory", add value to  dataConcatenation
      next cellX
      
     write dataConcatenation value to cell above [cellStart]

  loop until end of row.

Open in new window

0
 

Author Comment

by:tesla764
ID: 39614759
Yes your logic is correct.
0
 

Author Comment

by:tesla764
ID: 39614767
The actual Green color is...
RGB(153, 255, 51)
0
 

Author Comment

by:tesla764
ID: 39614792
I can provide you with the workbook and a scaled down version of the DB if you would prefer.
0
 
LVL 32

Expert Comment

by:Robberbaron (robr)
ID: 39616350
1/ just the workbook, with data in it.  Copy and paste <as-values> to leave out the db.  we can then work on the aggregation in isolation.

2/ the color is just from the current code.
0
 

Author Comment

by:tesla764
ID: 39616593
This is the workbook that is the result of selecting the criteria.
DRA-Summary.xlsx
0
 
LVL 32

Expert Comment

by:Robberbaron (robr)
ID: 39618328
here is my test1 , i am missing part of your request i guess.

1/ is the summary supposed to be just one of each text found ?
2/ is it supposed to be all cells in the 'Regualtory' column ?  ie multiple rows ?

can you draw arrows from the cells that are to make up the summary ?
DRA-Summary1.xlsm
0
 

Author Comment

by:tesla764
ID: 39622030
Here is a simplified, straight forward synopsis of this request...

Background...
The cells in row 3, the green  fill color is RGB(153,255,51)
The cells in row 4, the yellow fill color is RGB(255,255,0)
Note - In this screen shot the TEXT in the 1st green cell is
"GQ-005 - Approval Time"
            and the next green cell has
"GQ-008 - GMP Certificate"

Process…
In the area BETWEEN the cells that have the green RGB(153,255,51), in this case Columns D to W...
I want to copy the value in column "E" (Not Applicable) to column "A"
     Then copy the value in column "O" (3 Months)       to column "A"  (appended)

•      Note that the column data that gets appended has the word "Regulatory" in the header with the yellow fill color.
•      Note that there is a third occurrence of "Regulatory", the data in that column contains "3 Months" which has already been appended, there should be no duplicate data that gets appended.

Please refer to the spreadsheet that is attached “GQ Spreadsheet.xlsx” when reading this problem statement.

Hopefully this is clear. If not please ask any questions you may have.
Thanks for your help in advance.
GQ-Spreadsheet.xlsx
0
 

Author Closing Comment

by:tesla764
ID: 39663541
Thanks everybody for your participation.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question