Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Excel VBA data concatenation

Posted on 2013-10-24
20
Medium Priority
?
343 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1440 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:Berkson Wein
Berkson Wein earned 60 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
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 

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 1440 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 1440 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 1440 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 1440 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

721 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