help with Mid, left, right, search

rmooretrans

New Member
Joined
Feb 20, 2009
Messages
20
Cant seem to get the formula right for extracting which numbers I need out. ex.
a1 contains- w, 90-88 or L, 90-88
trying to extract first number if "w" and second number if "L"

can get the second without out the if "W" or "L" by using
=RIGHT(a1,LEN(a1)-SEARCH("-",a1,1)) gives me "88". getting the first number without the "w," or "L," is a different story using
=LEFT(a1,LEN(a1)-SEARCH(" ",a1,1)) gives me "w, 90"

and when I want one or the another based on the "W" or "L", well I'm lost.
Need some pointers in the right direction. Thx.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Assuming first character can only be "L" or "W" try

=IF(LEFT(A1)="L",REPLACE(A1,1,FIND("-",A1),"")+0,MID(A1,4,FIND("-",A1)-4)+0)
 
Upvote 0
I don't suppose those numbers are always 2 digits so that you could use the following?

=MID(A1,4+3*(LEFT(A1)="L"),2)+0
 
Upvote 0

Forum statistics

Threads
1,203,174
Messages
6,053,924
Members
444,694
Latest member
JacquiDaly

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