Varying left criteria based on 1st Letter....If Function?

  • Thread starter Thread starter seve
  • Start date Start date
S

seve

Hello,

I am using Pivot Tables for Inventory purposes.

I'd like to use a shortened description based on the first letter of
the description.

Can I use an If Statement?


Such as if 1st letter of Description is M - use 1st Left 5 characters,
if 1st letter of description is L - use 1st Left 8 characters?


Steve
 
=IF(LEFT(A1)="M",LEFT(A1,5),IF(LEFT(A1)="L",LEFT(A1,8),"If not then display
this"))

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

------------------------------­------------------------------­----------------
It's easier to beg forgiveness than ask permission :-)
------------------------------­------------------------------­----------------
 
Or perhaps more scalable:-

=LEFT(A1,VLOOKUP(LEFT(A1),{"L",8;"M",5},2,0))

which can be expanded quite easily to add more letters:-

=LEFT(A1,VLOOKUP(LEFT(A1),{"A",4;"B",5;"C",6;"L",8;"M",5;"X",3;"Y",4;"Z",5},2,0))

Regards
Ken................
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top