By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,045 Members | 1,743 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,045 IT Pros & Developers. It's quick & easy.

How Do I aggregate rows up when there value is Yes?

100+
P: 103
I have an excel sheet where there are a lot of columnst that have either Yes, No and Null Values. Going down the list there are companies and they may appear multiple times, however the columns may have different values. I want to loop through the repeat company's values and if they are yes, paste the value into the first appearance of the company's name. For example, Company A appears three times. I want to loop trought the 2nd and third time and if there is a value of yes, copy and paste it into the first time appearance in the same column. I paste a sample view below.


Before View
Expand|Select|Wrap|Line Numbers
  1. <table border="1">
  2. <tr>
  3. <td>Company</td>
  4. <td>A</td>
  5. <td>A</td>
  6. <td>A</td>
  7. <td>B</td>
  8. </tr>
  9. <tr>
  10. <td>Value 1</td>
  11. <td>Yes</td>
  12. <td>No</td>
  13. <td>No</td>
  14. <td>Yes</td>
  15. </tr>
  16. <tr>
  17. <td>Value 2</td>
  18. <td>No</td>
  19. <td>Yes</td>
  20. <td>No</td>
  21. <td>Yes</td>
  22. </tr>
  23. <tr>
  24. <td>Value 3</td>
  25. <td>Yes</td>
  26. <td>No</td>
  27. <td>No</td>
  28. <td>Yes</td>
  29. </tr>
  30. </table> 
  31.  
  32.  

After VBA Code View
Expand|Select|Wrap|Line Numbers
  1. <table border="1">
  2. <tr>
  3. <td>Company</td>
  4. <td>A</td>
  5. <td>B</td>
  6. </tr>
  7. <tr>
  8. <td>Value 1</td>
  9. <td>Yes</td>
  10. <td>Yes</td>
  11. </tr>
  12. <tr>
  13. <td>Value 2</td>
  14. <td>Yes</td>
  15. <td>Yes</td>
  16. </tr>
  17. <tr>
  18. <td>Value 3</td>
  19. <td>Yes</td>
  20. <td>Yes</td>
  21. </tr>
  22. </table> 
  23.  
Jul 17 '12 #1
Share this Question
Share on Google+
2 Replies


zmbd
Expert Mod 5K+
P: 5,397
Brain,
Required reading before you post: How to ask good questions - Read before submitting question

I'm not too sure how much help you're going to get here as this is an MS-Access forum.

I can only guess that your two code blocks are your Excel worksheets? In order to even begin to help I (read any of the experts/mods/users) would have to translate these - they are not usable as is!

Next, What have you tried to do? How have you tried to solve this problem? What specific error are you running in to?

-z
Jul 17 '12 #2

100+
P: 103
Yes, I made a lot of head way. This post has been changed and added to Visual Basic. And I made a mistake, I saw VBA and read VBE which is why I posted here.
Jul 18 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.