Divide data from a list to different sheets

KimmoT

New Member
Joined
Jun 16, 2015
Messages
1
I have a raw data table in excel in the following format (simplified example):

CATS
Siam165611.54
Mixed156561.54
DOGS
Bulldog140001.20
Labrador125001.10
BMW
Black250001.98
White250001.99
MB
RED280002.03
BLUE280002.01

This Data is on a separate data sheet. Then I have two other sheets, "ANIMALS" and "CARS". The data from the data sheet should be divided to the correct sheets, so DOGS & CATS --> ANIMALS, BMW & MB --> CARS. Just add the lists after each other. The group names (DOGS, CATS, BMW and MB) are static, but the size of the groups change.

I am somehow struggling what would be the easiest and simplest way to tackle this. Any tips would be appreciated!

Thanks in advance!
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Gary McMaster

Well-known Member
Joined
Feb 8, 2009
Messages
1,978
Hi KimmoT,

Welcome aboard!

I'm afraid your sample data is too simplified or at least much more sanitized than I suspect it really is.

Answers to questions similar to the following will be important in order for someone to help you.

Are Cats, Dogs, BMW, MB always on a row all by themselves?
Are Cats, Dogs, BMW, MB always bold?
Are there always two rows under each category (Cats, Dogs, BMW, MB)?
Are there always 3 populated columns in non-category rows?

How do I tell the difference between a car and an animal if I see "Impala" (as in Chevrolet)

Anything else that makes entries similar or unique to help identify which data goes where.

You can use Excel Jeanie to show some actual data from your sheet on this message board. The posting of un-sanitized data would be very helpful.
 
Upvote 0

JLGWhiz

Well-known Member
Joined
Feb 7, 2012
Messages
12,979
Office Version
  1. 2013
Platform
  1. Windows
I have a raw data table in excel in the following format (simplified example):

CATS
Siam165611.54
Mixed156561.54
DOGS
Bulldog140001.20
Labrador125001.10
BMW
Black250001.98
White250001.99
MB
RED280002.03
BLUE280002.01

This Data is on a separate data sheet. Then I have two other sheets, "ANIMALS" and "CARS". The data from the data sheet should be divided to the correct sheets, so DOGS & CATS --> ANIMALS, BMW & MB --> CARS. Just add the lists after each other. The group names (DOGS, CATS, BMW and MB) are static, but the size of the groups change.

I am somehow struggling what would be the easiest and simplest way to tackle this. Any tips would be appreciated!

Thanks in advance!
Well, the computer is not smart enough to tell the difference between an animal and a car, so the programmer would have to do that by using an aray for animal types and one for cars. The arrays could then be used in the code like:
Code:
Dim ary1 As Variant, ary2 As Variant, c As Range, i As Long
ary1 = Array("Cats", "Dogs")
ary2 = Array("BMW", "BM")
For i = LBound(ary1) To UBound(ary2)
    With ActiveSheet
        For Each c In .Range("A1", .Cells(Rows.Count, 1).End(xlUp))
            If c = ary1(i) Then
                'code to manipulate other data here
            End If
        Next
    End With
Next
Do the same thing with ary2.
 
Upvote 0

Forum statistics

Threads
1,195,849
Messages
6,011,953
Members
441,657
Latest member
Diupsy

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
Top