Copy rows from multiple different ranges within one sheet to another sheet with and/or without VBA

hairlossbyexcel

New Member
Joined
May 16, 2014
Messages
7
Hello,

The last few days I have been trying to figure this out with no luck whatsoever. I am using Excel 2010 32-bit with power query on a Windows 7 64-bit computer. I was going the use the html creator, but the dl link was down and I had to use screenshots.

I have a sheet titled "LeadSheet" that contains multiple data blocks of information (around 20). I have attached 2 examples of these data blocks and 2 examples of results needed below. I tried to create them so they would fill in the gaps of my explanation.

All of these data blocks are 7 columns wide and vary in row size from 10-250. The blocks of data all have titles on the 5th row, but are not headers, and then data beginning directly underneath. I hesitate calling them ranges because I only selected one data block as a range and named it "lead1" and then stopped not knowing if I was headed the right direction.

I first tried to create a table out of the range, but was unable to do so because the "Name" column is an array.
The phone and address columns are populated by VLOOKUP. And although the images show the column names as the same for name, phone and address theyare actually different, like name-firm1, name-firm17,address-firmxyz, etc, etc.
I apologize for not putting that in the images.
The "Option 1", "Option 2", "Option 3" and "Option 4" columns are generated using a =IF formula.

I have another sheet titled "ResultsSheet".I'm needing a way or code to copy entire rows from the multiple data blocks/ranges in the "LeadSheet", and paste it in the"ResultsSheet", based on any value occurring in any of the"Option" columns within the individual data blocks/ranges along with appending the "Option #" title to either end of the copied row.

The "LeadSheet" is constantly being updated so information is being added and taken off all the time. That being said, is there anyway to make it update as soon as the "LeadSheet" does or on a timed interval so that the"ResultsSheet" is always up to date. And also prevent it from continuing to re-copy over duplicates of information that has not changed?

Ifthe "Option #" result is the exact same percentage then the order does not matter between them.

Ifwithin the same data block/range both "Option" columns have data it is usually because of some error and is most likely bad datathat does not need to be copied. i.e. "Steven Seagal". If that makes this task much more difficult I can live with it.

If within two or more different data blocks/ranges the same name and info appears that if fine because the "Option #" will always be different. i.e. "Chuck Norris".

I am also trying to make the "ResultSheet" ordered from largest percentage to lowest, but I assume that should be done once the data is on the "ResultsSheet". No headers or titles are necessary on the "ResultsSheet"

I apologize for being so long winded in my attempt to be clear. If I need to clarify anything more please do not hesitate to ask.
Any and all help is greatly appreciated. Thank you.

Data Block example 1:

excel1.png


Data Block example 2:
excel2.png



Results:
excel3.png

either/or
excel4.png
 
Last edited:

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
hairlossbyexcel,

Is this even feasible?

We would have to see your actual raw data.

You are posting pictures/graphics. This means that if this was a problem where one needed to use your data, anyone trying to help you would have to enter the data manually. That makes no sense.


1. What version of Excel and Windows are you using?

2. Are you using a PC or a Mac?

Can you post a screenshot of the actual raw data worksheet?

And, can you post a screenshot of the worksheet results (manually formatted by you) that you are looking for?

To post your data, you can download and install one of the following two programs:
Excel Jeanie
http://www.mrexcel.com/forum/board-announcements/515787-forum-posting-guidelines.html#post2545970

Or, when using Internet Explorer, just put borders around your data in Excel and copy those cells into your post.
See reply #2 the BLUE text in the following link:
http://www.mrexcel.com/forum/about-board/444901-how-create-table-like-aladin.html#post2198045


If you are not able to give us screenshots:
You can upload your workbook to Box Net,
sensitive data changed
mark the workbook for sharing
and provide us with a link to your workbook.
 
Upvote 0
hairlossbyexcel,



We would have to see your actual raw data.

You are posting pictures/graphics. This means that if this was a problem where one needed to use your data, anyone trying to help you would have to enter the data manually. That makes no sense.

I do apologize. In my haste to get something posted without a working link to a htmlmaker of some kind, I just posted screenshots. Thank you for a working link to a html maker.

What version of Excel and Windows are you using?

Please refer to the second sentence of the OP.


Are you using a PC or a Mac?

Please refer to the second sentence of the OP.

Can you post a screenshot of the actual raw data worksheet?

I am unable to do that, but I did post a screenshot of generic data I created that represented the actual raw data that I need help with.
I will however post them as html this time so they can be cut and paste.

And, can you post a screenshot of the worksheet results (manually formatted by you) that you are looking for?

Same as the previous answer. I will also add that I am open to whatever makes it easier for the results worksheet whether that be with/without headings, table, or nothing but the raw results.

To post your data, you can download and install one of the following two programs:
Excel Jeanie
http://www.mrexcel.com/forum/board-announcements/515787-forum-posting-guidelines.html#post2545970

Or, when using Internet Explorer, just put borders around your data in Excel and copy those cells into your post.
See reply #2 the BLUE text in the following link:
http://www.mrexcel.com/forum/about-board/444901-how-create-table-like-aladin.html#post2198045

Again, thank you for the link.


If you are not able to give us screenshots:
You can upload your workbook to Box Net,
sensitive data changed
mark the workbook for sharing
and provide us with a link to your workbook.

If it becomes necessary for a workbook to be uploaded I will create one with the information I have provided here and upload it.


I tried to edit my op to reflect this, but was unable to do so:

-I have made all data blocks now named ranges "lead1", "lead2", etc.

-Ifwithin the same data block/range both "Option" columns have data it is usually because of some error and is most likely bad datathat does not need to be copied. i.e. "Steven Seagal". If that makes this task much more difficult I can live with it.* Edit - I have backtracked on this decision and believe it best to include this information if possible. The examples below will reflect that.


worksheet "LeadSheet"; range "lead1"

Excel 2010
JKLMNOP
Prof Plum555-555-1234123-345-3677123 Random RdAL 35401
Col Mustard555-555-2345123-345-63444567 Random RdAK 99999
Ms Scarlet555-555-3456123-345-32435476 Random RdNY 12345
Mrs. Peacock555-555-4567123-345-3254677 Random RdNE 58742
Mr. Green555-555-5678123-345-0976769 Random RdWA 85472
Ms. White555-555-6789123-345-2133568 Random RdOR 51247
Chuck Norris555-555-4567123-345-77779083 Random RdMT 21598

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]5[/TD]
[TD="bgcolor: #D9D9D9"]Name-C[/TD]
[TD="bgcolor: #D9D9D9"]HomePh-564[/TD]
[TD="bgcolor: #D9D9D9"]MobilePh-ghr[/TD]
[TD="bgcolor: #D9D9D9"]Address-fggrb[/TD]
[TD="bgcolor: #D9D9D9"]StateZip-adsg[/TD]
[TD="bgcolor: #D9D9D9"]Option 1[/TD]
[TD="bgcolor: #D9D9D9"]Option 2[/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]1.23%[/TD]
[TD="align: right"][/TD]

[TD="align: center"]7[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]8[/TD]

[TD="align: right"]87.57%[/TD]
[TD="align: right"][/TD]

[TD="align: center"]9[/TD]

[TD="align: right"][/TD]
[TD="align: right"]10.00%[/TD]

[TD="align: center"]10[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]11[/TD]

[TD="align: right"]17.00%[/TD]
[TD="align: right"][/TD]

[TD="align: center"]12[/TD]

[TD="align: right"][/TD]
[TD="align: right"]65.00%[/TD]

</tbody>
LeadSheet



worksheet "LeadSheet"; range "lead2"

Excel 2010
TUVWXYZ
Macgyver555-555-1111123-345-99993301 Silent PathwayIA, 51558
Sinjin555-555-2222123-345-88883854 Cinder AbbeyOK, 73336
Scrooge555-555-3333123-345-7777233 Dewy PromenadeMO, 64208
Chuck Norris555-555-4444123-345-34347204 Thunder VillageOH, 43823
Bruce Lee555-555-5555123-345-27273780 Fallen Sky FieldMO, 63457
Steven Seagal555-555-6666123-345-76766131 Merry RoundOH, 44309

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]5[/TD]
[TD="bgcolor: #D9D9D9"]Name-Y[/TD]
[TD="bgcolor: #D9D9D9"]HomePh-997[/TD]
[TD="bgcolor: #D9D9D9"]MobilePh-342[/TD]
[TD="bgcolor: #D9D9D9"]Address-yui[/TD]
[TD="bgcolor: #D9D9D9"]StateZip-xzc[/TD]
[TD="bgcolor: #D9D9D9"]Option 3[/TD]
[TD="bgcolor: #D9D9D9"]Option 4[/TD]

[TD="align: center"]6[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]7[/TD]

[TD="align: right"][/TD]
[TD="align: right"]25.20%[/TD]

[TD="align: center"]8[/TD]

[TD="align: right"]90.50%[/TD]
[TD="align: right"][/TD]

[TD="align: center"]9[/TD]

[TD="align: right"][/TD]
[TD="align: right"]100.00%[/TD]

[TD="align: center"]10[/TD]

[TD="align: right"]100.00%[/TD]
[TD="align: right"][/TD]

[TD="align: center"]11[/TD]

[TD="align: right"]2.77%[/TD]
[TD="align: right"]77.00%[/TD]

</tbody>
LeadSheet



worksheet "ResultsSheet"

Excel 2010
ABCDEFG
Bruce Lee555-555-5555123-345-27273780 Fallen Sky FieldMO, 63457Option 3
Chuck Norris555-555-4444123-345-34347204 Thunder VillageOH, 43823Option 4
Scrooge555-555-3333123-345-7777233 Dewy PromenadeMO, 64208Option 3
Ms Scarlet555-555-3456123-345-32435476 Random RdNY 12345Option 1
Steven Seagal555-555-6666123-345-76766131 Merry RoundOH, 44309Option 4
Chuck Norris555-555-4567123-345-77779083 Random RdMT 21598Option 2
Sinjin555-555-2222123-345-88883854 Cinder AbbeyOK, 73336Option 4
Ms. White555-555-6789123-345-2133568 Random RdOR 51247Option 1
Mrs. Peacock555-555-4567123-345-3254677 Random RdNE 58742Option 2
Steven Seagal555-555-6666123-345-76766131 Merry RoundOH, 44309Option 3
Prof Plum555-555-1234123-345-3677123 Random RdAL 35401Option 1

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="bgcolor: #BFBFBF"]Name[/TD]
[TD="bgcolor: #BFBFBF"]HomePh[/TD]
[TD="bgcolor: #BFBFBF"]MobilePh[/TD]
[TD="bgcolor: #BFBFBF"]Address[/TD]
[TD="bgcolor: #BFBFBF"]StateZip[/TD]
[TD="bgcolor: #BFBFBF"]Percentage[/TD]
[TD="bgcolor: #BFBFBF"]Option #[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]100.00%[/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]100.00%[/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]90.50%[/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]87.57%[/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]77.00%[/TD]

[TD="align: center"]7[/TD]

[TD="align: right"]65.00%[/TD]

[TD="align: center"]8[/TD]

[TD="align: right"]25.20%[/TD]

[TD="align: center"]9[/TD]

[TD="align: right"]17.00%[/TD]

[TD="align: center"]10[/TD]

[TD="align: right"]10.00%[/TD]

[TD="align: center"]11[/TD]

[TD="align: right"]2.77%[/TD]

[TD="align: center"]12[/TD]

[TD="align: right"]1.23%[/TD]

</tbody>
ResultsSheet



worksheet "ResultsSheet" (If it is to difficult to combine the percentage columns like the example above)

Excel 2010
ABCDEFGH
Bruce Lee555-555-5555123-345-27273780 Fallen Sky FieldMO, 63457Option 3
Chuck Norris555-555-4444123-345-34347204 Thunder VillageOH, 43823Option 4
Scrooge555-555-3333123-345-7777233 Dewy PromenadeMO, 64208Option 3
Ms Scarlet555-555-3456123-345-32435476 Random RdNY 12345Option 1
Steven Seagal555-555-6666123-345-76766131 Merry RoundOH, 44309Option 4
Chuck Norris555-555-4567123-345-77779083 Random RdMT 21598Option 2
Sinjin555-555-2222123-345-88883854 Cinder AbbeyOK, 73336Option 4
Ms. White555-555-6789123-345-2133568 Random RdOR 51247Option 1
Mrs. Peacock555-555-4567123-345-3254677 Random RdNE 58742Option 2
Steven Seagal555-555-6666123-345-76766131 Merry RoundOH, 44309Option 3
Prof Plum555-555-1234123-345-3677123 Random RdAL 35401Option 1

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="bgcolor: #BFBFBF"]Name[/TD]
[TD="bgcolor: #BFBFBF"]HomePh[/TD]
[TD="bgcolor: #BFBFBF"]MobilePh[/TD]
[TD="bgcolor: #BFBFBF"]Address[/TD]
[TD="bgcolor: #BFBFBF"]StateZip[/TD]
[TD="bgcolor: #BFBFBF"]Percentage[/TD]
[TD="bgcolor: #BFBFBF"]Percentage2[/TD]
[TD="bgcolor: #BFBFBF"]Option #[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]100.00%[/TD]
[TD="align: right"][/TD]

[TD="align: center"]3[/TD]

[TD="align: right"][/TD]
[TD="align: right"]100.00%[/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]90.50%[/TD]
[TD="align: right"][/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]87.57%[/TD]
[TD="align: right"][/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]2.77%[/TD]
[TD="align: right"]77.00%[/TD]

[TD="align: center"]7[/TD]

[TD="align: right"][/TD]
[TD="align: right"]65.00%[/TD]

[TD="align: center"]8[/TD]

[TD="align: right"][/TD]
[TD="align: right"]25.20%[/TD]

[TD="align: center"]9[/TD]

[TD="align: right"]17.00%[/TD]
[TD="align: right"][/TD]

[TD="align: center"]10[/TD]

[TD="align: right"][/TD]
[TD="align: right"]10.00%[/TD]

[TD="align: center"]11[/TD]

[TD="align: right"]2.77%[/TD]
[TD="align: right"]77.00%[/TD]

[TD="align: center"]12[/TD]

[TD="align: right"]1.23%[/TD]
[TD="align: right"][/TD]

</tbody>
ResultsSheet



Would this be better accomplished with a formula or vba? I prefer formulas...most likely out of ignorance of vba.
 
Upvote 0
hairlossbyexcel,

Thanks for the screenshots.

I have another sheet titled "ResultsSheet".I'm needing a way or code to copy entire rows from the multiple data blocks/ranges in the "LeadSheet", and paste it in the"ResultsSheet", based on any value occurring in any of the"Option" columns within the individual data blocks/ranges along with appending the "Option #" title to either end of the copied row.

If I understand you correctly, based on your instructions/directions, I would think that a formula solution would not work for the ResultsSheet

You will have to pick/choose what the ResultsSheet should look like?


At the present time, I can not see the logic to solve your request.

Click on the Reply to Thread button, and just put the word BUMP in the thread. Then, click on the Post Quick Reply button, and someone else will assist you.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,875
Members
452,363
Latest member
merico17

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