Sorting a list into two catagories

BradM

New Member
Joined
Jan 27, 2005
Messages
45
Hello, I having trouble with making a simple statement.

I have a list of items that belong in two catagories. The second last character in the item code defines which catagory. is it possible to have a statement that defines whether the item is in catagory a or b.


The trick is that the catagory defining character for an "A" item is either a "P" or "T" and catagory "B" is all other caracters.

ie.

123P6 = "A"
456T2 = "A"
789G1 = "B"
123H5 = "B"
 

Some videos you may like

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

acw

MrExcel MVP
Joined
Feb 13, 2004
Messages
4,814
Hi

This assumes that the data is always in the same format as you have provided ie the determining character is always in position 4 of the string.

=IF(OR(MID(A1,4,1)="P",MID(A1,4,1) = "T"),"A","B")

Tony
 

Watch MrExcel Video

Forum statistics

Threads
1,123,385
Messages
5,601,328
Members
414,444
Latest member
lionking15

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