Help with Microsoft Excel?

In each cell in a column in my spreadsheet, there are 8 possibilites: BBB BBP BPB BPP PPP PPB PBP PBB Is there a formula I can implement so that if there is a: BBB the next column over will have a 1 BBP the next column over will have a 2 BPB the next column over will have a 3 BPP the next column over... show more In each cell in a column in my spreadsheet, there are 8 possibilites:

BBB BBP BPB BPP PPP PPB PBP PBB

Is there a formula I can implement so that if there is a:

BBB the next column over will have a 1
BBP the next column over will have a 2
BPB the next column over will have a 3
BPP the next column over will have a 4
PPP the next column over will have a 5
PPB the next column over will have a 6
PBP the next column over will have a 7
PBB the next column over will have an 8

Example:

A........B
PBB...8
BBB...1
BPB...3
PBP...7 etc

Thanks.
4 answers 4