ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Varying left criteria based on 1st Letter....If Function? (https://www.excelbanter.com/excel-discussion-misc-queries/57306-varying-left-criteria-based-1st-letter-if-function.html)

seve

Varying left criteria based on 1st Letter....If Function?
 
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


Ken Wright

Varying left criteria based on 1st Letter....If Function?
 
=IF(LEFT(A1)="M",LEFT(A1,5),IF(LEFT(A1)="L",LEFT(A 1,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 :-)
------------------------------*------------------------------*----------------



"seve" wrote in message
oups.com...
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




Ken Wright

Varying left criteria based on 1st Letter....If Function?
 
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................


"Ken Wright" wrote in message
...
=IF(LEFT(A1)="M",LEFT(A1,5),IF(LEFT(A1)="L",LEFT(A 1,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 :-)
------------------------------*------------------------------*----------------



"seve" wrote in message
oups.com...
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







All times are GMT +1. The time now is 09:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com