LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 34
Default How do I reshuffle some column data based on a coding scheme?

Suppose I have some data arranged as follows, barring the fact that the
products listings in columns A and C are in reality represented by a numeric
coding system:

A B C D

1 Product 1 Quantity 1 Product 2 Quantity 2


2 Apples 2 Carrots 3

3 Apples 4 Oranges 5

4 Carrots 6 Apples 3

5 Apples 5 Hamburgers 4

6 Hamburgers 2 Gallons of Milk 5


Suppose I wanted to create 2 new columns, E and F, that comprise a
reshuffling and collapsing of the quantity data in columns B and D such that:

I. All of the fruits appear in column E, and all of the vegetables appear in
column F
II. All of the quantities corresponding to a single broad category (fruits
or vegetables) that appear in the same row are aggregated in the same
appropriate column.
III. All of the quantities that correspond to a product that falls outside
of the main fruit or vegetable categories are considered null.

So for instance, the two new columns I would like to create would end up
appearing as follows:

E F

1. Fruits Vegetables


2. 2 3

3. 9

4. 3 6

5. 5

6.

Do you follow? Notice that

Row 2: Everything has stayed exactly the same, because the fruit and
vegetable are already in the proper column they need to be in.

Row 3: Apples in B and oranges in D have been aggregated in E because they
are both fruits, and F, vegetables, is blank because no vegetables appeared
in that row.

Row 4: The apples in column D and the carrots in column B have switched
places because fruits need to be in E, and vegetables need to be in F.

Row 5: Since only the apples in B fall into a relevant product group scheme,
only they are counted. The space corresponding to the hamburgers in D is
blank.

Row 6: It is a complete blank, because neither hamburgers nor milk are
fruits or vegetables.

Can anyone offer advice on how to proceed?

Mick

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
making a new column based on data in an existing column newyorkjoy Excel Discussion (Misc queries) 4 August 2nd 07 02:42 AM
Formatting Rows of Data based on Column Data mwmasch Excel Worksheet Functions 3 July 24th 07 04:36 PM
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look [email protected] Excel Discussion (Misc queries) 1 December 27th 06 05:47 PM
I need to count data in one colum based on data in another column LG Excel Worksheet Functions 1 June 13th 06 02:41 PM
Macro to move data to different column based on data in another co malycom Excel Discussion (Misc queries) 3 August 2nd 05 07:07 PM


All times are GMT +1. The time now is 10:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"