Sorting of data

mirrorwatch

New Member
Joined
Sep 28, 2011
Messages
31
Firstly, P represents positive and N represents negative.

I want

<table border="1" cellpadding="0" cellspacing="0"><tbody><tr style="FONT-WEIGHT: bold; FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center"><td>
</td> <td>A</td> <td>B</td></tr> <tr style="HEIGHT: 18px"> <td style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">1</td> <td style="BACKGROUND-COLOR: #99cc00">Items</td> <td style="BACKGROUND-COLOR: #99cc00">Effect</td></tr> <tr style="HEIGHT: 18px"> <td style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">2</td> <td>Apple</td> <td style="TEXT-ALIGN: right">P</td></tr> <tr style="HEIGHT: 18px"> <td style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">3</td> <td>Orange</td> <td style="TEXT-ALIGN: right">N</td></tr> <tr style="HEIGHT: 18px"> <td style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">4</td> <td>Mouse</td> <td style="TEXT-ALIGN: right">P</td></tr> <tr style="HEIGHT: 18px"> <td style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">5</td> <td>Book</td> <td style="TEXT-ALIGN: right">N</td></tr> <tr style="HEIGHT: 18px"> <td style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">6</td> <td>Apple</td> <td style="TEXT-ALIGN: right">N
</td></tr> <tr style="HEIGHT: 18px"> <td style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">7</td> <td>Watch</td> <td style="TEXT-ALIGN: right">P</td></tr> <tr style="HEIGHT: 18px"> <td style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">8</td> <td>Paper</td> <td style="TEXT-ALIGN: right">N</td></tr> <tr style="HEIGHT: 18px"> <td style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">9</td> <td>Paper</td> <td style="TEXT-ALIGN: right">P

</td></tr></tbody></table>
to show

<table border="1" cellpadding="0" cellspacing="0"><tbody><tr style="FONT-WEIGHT: bold; FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center"><td>
</td> <td>A</td> <td>B</td></tr> <tr style="HEIGHT: 18px"> <td style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">1</td> <td style="BACKGROUND-COLOR: #99cc00">Items</td> <td style="BACKGROUND-COLOR: #99cc00">Effect</td></tr> <tr style="HEIGHT: 18px"> <td style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">2</td> <td>Apple</td> <td style="TEXT-ALIGN: right">
</td></tr> <tr style="HEIGHT: 18px"> <td style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">3</td> <td>Orange</td> <td style="TEXT-ALIGN: right">
</td></tr> <tr style="HEIGHT: 18px"> <td style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">4</td> <td>Mouse</td> <td style="TEXT-ALIGN: right">1</td></tr> <tr style="HEIGHT: 18px"> <td style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">5</td> <td>Book</td> <td style="TEXT-ALIGN: right">
</td></tr> <tr style="HEIGHT: 18px"> <td style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">6</td> <td>Watch</td> <td style="TEXT-ALIGN: right">1
</td></tr> <tr style="HEIGHT: 18px"> <td style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">7</td> <td>Paper</td> <td style="TEXT-ALIGN: right">
</td></tr> <tr style="HEIGHT: 18px"> <td style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">
</td> <td>
</td> <td style="TEXT-ALIGN: right">
</td></tr> <tr style="HEIGHT: 18px"> <td style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">
</td> <td>
</td> <td style="TEXT-ALIGN: right">
</td></tr></tbody></table>

As apple/paper has Negative and Positive meaning nil at the end.
And as there are many items so I want a macro to generate the 2nd type of table easier and quicker.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,224,586
Messages
6,179,713
Members
452,939
Latest member
WCrawford

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