excel function replace all letters in document with numbers automatically

%3CLINGO-SUB%20id%3D%22lingo-sub-1535912%22%20slang%3D%22en-US%22%3Eexcel%20function%20replace%20all%20letters%20in%20document%20with%20numbers%20automatically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1535912%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%20I'm%20in%20need%20of%20some%20help%20and%20I%20cannot%20find%20a%20solution%20online.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20document%20that%20has%20uniform%20sizes.%20i.e.%20S%2C%20M%2C%20L%2C%20XL%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20need%20to%20replace%20those%20sizes%20automatically%3A%20S%3D1%2C%20M%3D2%2C%20L%3D3%2C%20xl%20%3D4%26nbsp%3B%20and%20so%20on.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ecan%20anyone%20help%20me%20with%20a%20function%3F%20Ideally%2C%20it%20would%20be%20nice%20to%20have%20a%20macro%20or%20a%20document%20wide%20function%20so%20I%20don't%20have%20to%20put%20the%20function%20in%20each%20cell.%26nbsp%3B%20thank%20you%20so%20much%20for%20the%20help!!!!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1535912%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1536084%22%20slang%3D%22en-US%22%3ERe%3A%20excel%20function%20replace%20all%20letters%20in%20document%20with%20numbers%20automatically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1536084%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F734241%22%20target%3D%22_blank%22%3E%40bradpeterson%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20would%20be%20fairly%20easy%20to%20write%20a%20formula%20along%20the%20lines%20below%3A%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3DIFS(A1%3D%22S%22%2C1%2CA1%3D%22M%22%2C2%2CA1%3D%22L%22%2C3....)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3Eand%20place%20such%20a%20formula%20in%20a%20cell%20adjacent%20to%20the%20column%20with%20your%20letter%20size.%3C%2FP%3E%3CP%3EThen%20you%20could%20use%20Format....Column...Hide%20to%20hide%20the%20letter-size%20column%2C%20and%20use%20only%20the%20number.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20would%20work%20best%20if%20your%20data%20are%20in%20an%20official%20Excel%20Table.%20Which%20leads%20me%20to%20a%20question%20or%20two%3A%3C%2FP%3E%3CUL%3E%3CLI%3EWhere%20is%20the%20data%20in%20question%20coming%20from%3F%3C%2FLI%3E%3CLI%3EHow%20frequently%20does%20it%20change%20(get%20updated)%3F%3C%2FLI%3E%3CLI%3EWhat's%20the%20process%20of%20which%20this%20is%20a%20part%3F%3C%2FLI%3E%3CLI%3EWhat%20happens%20%22downstream%22%20with%20the%20data%2C%20especially%20this%20size%20data%3F%3C%2FLI%3E%3C%2FUL%3E%3CP%3EThese%20are%20not%20incidental%20questions.%20The%20%3CEM%3Etruly%20best%20way%3C%2FEM%3E%20to%20handle%20your%20situation%20may%20depend%20a%20lot%20on%20the%20bigger%20picture%20of%20which%20it's%20a%20part.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1536103%22%20slang%3D%22en-US%22%3ERe%3A%20excel%20function%20replace%20all%20letters%20in%20document%20with%20numbers%20automatically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1536103%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F734241%22%20target%3D%22_blank%22%3E%40bradpeterson%3C%2FA%3E%26nbsp%3BI'm%20far%20from%20an%20expert%20on%20VBA%2C%20but%20the%20code%20below%20does%20the%20trick.%20Specify%20the%20range%20(A1%20to%20C100%20in%20the%20example)%20that%20you%20want%20to%20evaluate%20and%20add%20%22Case%22%20statements%20for%20all%20relevant%20size%20indicators.%20I%20trust%20that%20a%20real%20VBA%20expert%20can%20come%20up%20with%20something%20better.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-visual%22%3E%3CCODE%3ESub%20ReplaceSize()%0A%0ADim%20ws%20As%20Range%0ASet%20ws%20%3D%20ThisWorkbook.Sheets(%22Sheet1%22).Range(%22A1%3AC100%22)%0A%0AFor%20Each%20c%20In%20ws%0A%0A%20%20%20%20Select%20Case%20c%0A%20%20%20%20%0A%20%20%20%20%20%20%20%20Case%20%22S%22%0A%20%20%20%20%20%20%20%20%20%20%20%20c.Value%20%3D%201%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20Case%20%22M%22%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20c.Value%20%3D%202%0A%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20Case%20%22L%22%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20c.Value%20%3D%203%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20Case%20%22XL%22%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20c.Value%20%3D%204%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20End%20Select%0A%0ANext%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1536123%22%20slang%3D%22de-DE%22%3ESubject%3A%20excel%20function%20replace%20all%20letters%20in%20document%20with%20numbers%20automatically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1536123%22%20slang%3D%22de-DE%22%3EWith%20VBA%20%3CBR%20%2F%3E%3CBR%20%2F%3E%20Sub%20Row_Column_width()%20%3CBR%20%2F%3E%20With%20Sheets(%2269%22)%20%3CBR%20%2F%3E%20.%20Rows(%2250%3A50%22).%20RowHeight%20%3D%2063.75%20%3CBR%20%2F%3E%20.%20Columns(%22A%3AA%22).%20ColumnWidth%20%3D%204%20%3CBR%20%2F%3E%20.%20Columns(%22B%3AH%22).%20ColumnWidth%20%3D%201.86%20%3CBR%20%2F%3E%20.%20Columns(%22I%3AI%22).%20ColumnWidth%20%3D%2035.14%20%3CBR%20%2F%3E%20.%20Columns(%22J%3AJ%22).%20ColumnWidth%20%3D%2014.71%20%3CBR%20%2F%3E%20.%20Columns(%22K%3AK%22).%20ColumnWidth%20%3D%2013%20%3CBR%20%2F%3E%20.%20Columns(%22L%3AL%22).%20ColumnWidth%20%3D%2012.86%20%3CBR%20%2F%3E%20.%20Columns(%22M%3AM%22).%20ColumnWidth%20%3D%2030%20%3CBR%20%2F%3E%20End%20With%20End%20Sub%20If%20you%20liked%20my%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3E%20solution%2C%20I%20would%20be%20happy%20to%20receive%20a%20reply%20with%20a%20cross%20as%20the%20correct%20answer%20and%20a%20thumbs%20up.%20If%20it%20is%20not%20an%20option%2C%20please%20ignore%20or%20inform.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%20Nikolino%20%3CBR%20%2F%3E%20I%20know%20I%20don't%20know%20anything%20(Socrates)%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1536155%22%20slang%3D%22en-US%22%3EBetreff%3A%20excel%20function%20replace%20all%20letters%20in%20document%20with%20numbers%20automatically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1536155%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F722750%22%20target%3D%22_blank%22%3E%40Nikolino%3C%2FA%3E%26nbsp%3B%3F%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1536182%22%20slang%3D%22de-DE%22%3ESubject%3A%20excel%20function%20replace%20all%20letters%20in%20document%20with%20numbers%20automatically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1536182%22%20slang%3D%22de-DE%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F722750%22%20target%3D%22_blank%22%3E%40Nikolino%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAdjust%20column%20width%20according%20to%20cell%20value%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22tlid-translation%20translation%22%3E%3CSPAN%20class%3D%22%22%3EWith%20file%20where%20you%20can%20set%20the%20column%20width%20as%20desired%20....%20with%20VBA.%20%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22%22%3E%20Freehand%20fished%20from%20the%20Internet%20and%20prepared%20...%20Completely%20fresh.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22tlid-translation%20translation%22%3E%3CSPAN%20class%3D%22%22%3E...%20and%20as%20I%20said%2C%20if%20you%20liked%20it%20...%20high%20%3C%2FSPAN%3E%20%3A-))%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENikolino%3C%2FP%3E%3CP%3EI%20know%20I%20don't%20know%20anything%20(Socrates)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1536185%22%20slang%3D%22de-DE%22%3ESubject%3A%20excel%20function%20replace%20all%20letters%20in%20document%20with%20numbers%20automatically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1536185%22%20slang%3D%22de-DE%22%3EHere%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3E%20hope%20I%20did%20nothing%20wrong%20...%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1536216%22%20slang%3D%22en-US%22%3EBetreff%3A%20excel%20function%20replace%20all%20letters%20in%20document%20with%20numbers%20automatically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1536216%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F722750%22%20target%3D%22_blank%22%3E%40Nikolino%3C%2FA%3E%26nbsp%3BDon't%20really%20know%20what%20your%20intentions%20are%2C%20but%20you%20are%20certainly%20not%20responding%20to%20the%20issue%20in%20this%20thread.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1536287%22%20slang%3D%22en-US%22%3EBetreff%3A%20excel%20function%20replace%20all%20letters%20in%20document%20with%20numbers%20automatically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1536287%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPerhaps%20English%26lt%3B-%26gt%3BGerman%20translation%20is%20very%20approximate%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1536590%22%20slang%3D%22de-DE%22%3ESubject%3A%20excel%20function%20replace%20all%20letters%20in%20document%20with%20numbers%20automatically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1536590%22%20slang%3D%22de-DE%22%3EHi%20Riny_van_Eekelen%2C%20%3CBR%20%2F%3E%20Are%20you%20sure%20about%20that%3F%20%3CBR%20%2F%3E%20As%20I%20understood%20it%20from%20the%20translation%20(I%20speak%20mainly%20German%20that%20does%20not%20mean%20that%20I%20can't%20speak%20some%20other%20languages)%2C%20you%20want%20to%20have%20columns%20in%20different%20widths%20with%20VBA.%20%3CBR%20%2F%3E%20That's%20exactly%20what%20I%20did%2C%20and%20at%20the%20same%20time%20I%20also%20showed%20an%20additional%20option.%20%3CBR%20%2F%3E%20Therefore%20I%20do%20not%20understand%20your%20suggestion.%20%3CBR%20%2F%3E%20Just%20try%20to%20help%20as%20far%20as%20I%20can%2C%20despite%20my%20ignorance%20...%20Because%20the%20principle%20is%20%22help%20to%20be%20helped%22%2C%20so%20the%20helped%20can%20learn%20something%20new%20and%20who%20helped%20to%20gain%20some%20experience.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%20But%20as%20I%20said%2C%20do%20not%20want%20to%20step%20anyone%20too%20close%20%3CBR%20%2F%3E%20and%20if%20I%20have%20disturbed%20anyone%20with%20my%20comments%2C%20please%20forgive%20me%20%3CBR%20%2F%3E%20...%20Because%20there%20was%20certainly%20no%20intention.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%20Nikolino%20%3CBR%20%2F%3E%20Do%20not%20look%20for%20mistakes%2C%20look%20for%20solutions.%20%3CBR%20%2F%3E%20Henry%20Ford%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1536638%22%20slang%3D%22en-US%22%3EBetreff%3A%20excel%20function%20replace%20all%20letters%20in%20document%20with%20numbers%20automatically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1536638%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F722750%22%20target%3D%22_blank%22%3E%40Nikolino%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENope%2C%20that's%20about%20mapping%20of%20clothes%20sizes%20(%3CSPAN%3ES%2C%20M%2C%20L%2C%20XL%2C...)%20to%20sequential%26nbsp%3Bnumbers.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1536692%22%20slang%3D%22de-DE%22%3ESubject%3A%20excel%20function%20replace%20all%20letters%20in%20document%20with%20numbers%20automatically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1536692%22%20slang%3D%22de-DE%22%3EHi%20Mr.%20Sergei%20Baklan%20%26amp%3B%20Mr.%20Riny_van_Eekelen%2C%20%3CBR%20%2F%3E%3CBR%20%2F%3E%20Now%20that%20Mr.%20Baklan%20has%20brought%20this%20to%20my%20attention%2C%20I%20have%20seen%20the%20mistake%20of%20mine.%20%3CBR%20%2F%3E%20I%20would%20like%20to%20apologize%20for%20my%20mistake%20to%20everyone%20involved%20...%20Who%20can%20read%20and%20googling%20has%20an%20advantage%20...%20what%20I%20missed%20%3A-(.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%20Thanks%20again%20for%20the%20tip%20and%20sorry%20if%20I%20accidentally%20stepped%20on%20the%20wrong%20foot%2C%20it%20was%20definitely%20not%20my%20intention%20...%20as%20I%20said%20%22help%20to%20be%20helped%22.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%20Have%20a%20nice%20day%20and%20thank%20you%20for%20your%20attention%20%3A-).%20%3CBR%20%2F%3E%3CBR%20%2F%3E%20Nikolino%20%3CBR%20%2F%3E%20When%20i%20know%20that%20i%20don't%20know%2C%20when%20does%20I%20know%20when%20i%20know%20something%3F%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1536694%22%20slang%3D%22en-US%22%3EBetreff%3A%20excel%20function%20replace%20all%20letters%20in%20document%20with%20numbers%20automatically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1536694%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F722750%22%20target%3D%22_blank%22%3E%40Nikolino%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENo%20problems%2C%20have%20a%20nice%20day%20too%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1537300%22%20slang%3D%22en-US%22%3ERe%3A%20excel%20function%20replace%20all%20letters%20in%20document%20with%20numbers%20automatically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1537300%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3B%20thank%20you%20for%20your%20solution.%20I%20tried%20the%20code%20and%20found%20some%20success%20but%20then%20I%20tried%20to%20upload%20that%20roster%20into%20my%20webservice.%20unfortunately%2C%20the%20function%20in%20the%20cell%20tripped%20up%20my%20importer.%20so%20I%20have%20to%20find%20a%20different%20solution%20besides%20excel.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1537306%22%20slang%3D%22en-US%22%3ERe%3A%20excel%20function%20replace%20all%20letters%20in%20document%20with%20numbers%20automatically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1537306%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F734241%22%20target%3D%22_blank%22%3E%40bradpeterson%3C%2FA%3E%26nbsp%3Bjust%20to%20poke%20my%20two%20cents%20in%20here%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20can%20see%20where%20the%20VBA%20code%20may%20trip%20up%20the%20importer%2C%20but%20if%20you%20use%20the%20first%20suggestion%20to%20have%20an%20%22if%22%20statement%20then%20I%20think%20that%20you%20can%20make%20that%20work.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EBefore%20you%20do%20this%2C%20are%20you%20importing%20data%20regularly%20or%20is%20this%20a%20one%20time%20event%3F%26nbsp%3B%20Will%20you%20have%20to%20repeat%20the%20'clean%20up'%20each%20time%3F%26nbsp%3B%20If%20so%2C%20you%20might%20want%20to%20run%20this%20as%20a%20macro%20to%20record%20the%20building%20of%20the%20IF%20statement%2C%20the%20copy%20of%20the%20resulting%20column%20and%20the%20paste%20of%20the%20results%20-%20so%20you%20can%20have%20your%20raw%20data%2C%20run%20the%20macro%20and%20then%20import%20the%20data.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJust%20me%20thinking%20out%20of%20the%20box.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1537337%22%20slang%3D%22en-US%22%3ERe%3A%20excel%20function%20replace%20all%20letters%20in%20document%20with%20numbers%20automatically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1537337%22%20slang%3D%22en-US%22%3E%3CP%3Ethank%20you%20for%20your%20response.%20I%20think%20you're%20right%20about%20using%20a%20macro.%20that%20I%20could%20run%20on%20all%20my%20rosters.%20however%2C%20after%20much%20trial%20and%20error%20my%20boss%20has%20changed%20my%20direction%20so%20I'm%20moving%20into%20different%20solutions.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hello, I'm in need of some help and I cannot find a solution online. 

 

I have a document that has uniform sizes. i.e. S, M, L, XL

 

I need to replace those sizes automatically: S=1, M=2, L=3, xl =4  and so on.

 

can anyone help me with a function? Ideally, it would be nice to have a macro or a document wide function so I don't have to put the function in each cell.  thank you so much for the help!!!!

15 Replies

@bradpeterson 

 

It would be fairly easy to write a formula along the lines below:

=IFS(A1="S",1,A1="M",2,A1="L",3....)

and place such a formula in a cell adjacent to the column with your letter size.

Then you could use Format....Column...Hide to hide the letter-size column, and use only the number.

 

This would work best if your data are in an official Excel Table. Which leads me to a question or two:

  • Where is the data in question coming from?
  • How frequently does it change (get updated)?
  • What's the process of which this is a part?
  • What happens "downstream" with the data, especially this size data?

These are not incidental questions. The truly best way to handle your situation may depend a lot on the bigger picture of which it's a part.

@bradpeterson I'm far from an expert on VBA, but the code below does the trick. Specify the range (A1 to C100 in the example) that you want to evaluate and add "Case" statements for all relevant size indicators. I trust that a real VBA expert can come up with something better.

Sub ReplaceSize()

Dim ws As Range
Set ws = ThisWorkbook.Sheets("Sheet1").Range("A1:C100")

For Each c In ws

    Select Case c
    
        Case "S"
            c.Value = 1
        
        Case "M"
        
            c.Value = 2
            
        Case "L"
        
            c.Value = 3
        
        Case "XL"
        
            c.Value = 4
        
    End Select

Next

 

With VBA

Sub Row_Column_width()
With Sheets("69")
.Rows("50:50").RowHeight = 63.75
.Columns("A:A").ColumnWidth = 4
.Columns("B:H").ColumnWidth = 1.86
.Columns("I:I").ColumnWidth = 35.14
.Columns("J:J").ColumnWidth = 14.71
.Columns("K:K").ColumnWidth = 13
.Columns("L:L").ColumnWidth = 12.86
.Columns("M:M").ColumnWidth = 30
End With
End Sub

If you liked my solution, I would be happy to receive a reply with a cross as the correct answer and a thumbs up. If it is not an option, please ignore or inform.

Nikolino
I know I don't know anything (Socrates)

@Nikolino 

Adjust column width according to cell value

 

With file where you can set the column width as desired .... with VBA.
Freehand fished from the Internet and prepared ... completely fresh.

 

... and as I said, if you liked it ... high :-))

 

Nikolino

I know I don't know anything (Socrates)

Here

hope I did nothing wrong ...

@Nikolino Don't really know what your intentions are, but you are certainly not responding to the issue in this thread.

 

@Riny_van_Eekelen 

Perhaps English<->German translation is very approximate

Hi Riny_van_Eekelen,
Are you sure about that?
As I understood it from the translation (I speak mainly German that does not mean that I can’t speak some other languages), you want to have columns in different widths with VBA.
That's exactly what I did, and at the same time I also showed an additional option.
Therefore I do not understand your suggestion.
Just try to help as far as I can, despite my ignorance ... because the principle is "help to be helped", so the helped can learn something new and who helped to gain some experience.

But as I said, do not want step anyone too close
and if I have disturbed anyone with my comments, please forgive me
... because there was certainly no intention.

Nikolino
Do not look for mistakes, look for solutions.
Henry Ford

@Nikolino 

Nope, that's about mapping of clothes sizes (S, M, L, XL,...) to sequential numbers.

Hi Mr. Sergei Baklan & Mr. Riny_van_Eekelen,

Now that Mr. Baklan has brought this to my attention, I have seen the mistake of mine.
I would like to apologize for my mistake to everyone involved ... who can read and googling has an advantage ... what I missed :-(.

Thanks again for the tip and sorry if I accidentally stepped on the wrong foot, it was definitely not my intention ... as I said "help to be helped".

Have a nice day and thank you for your attention :-).

Nikolino
When i know that i don't know, when does i know when i know something?


@Riny_van_Eekelen  thank you for your solution. I tried the code and found some success but then I tried to upload that roster into my webservice. unfortunately, the function in the cell tripped up my importer. so I have to find a different solution besides excel.

@bradpeterson just to poke my two cents in here,

 

I can see where the VBA code may trip up the importer, but if you use the first suggestion to have an "if" statement then I think that you can make that work.


Before you do this, are you importing data regularly or is this a one time event?  Will you have to repeat the 'clean up' each time?  If so, you might want to run this as a macro to record the building of the IF statement, the copy of the resulting column and the paste of the results - so you can have your raw data, run the macro and then import the data.

 

Just me thinking out of the box.

thank you for your response. I think you're right about using a macro. that I could run on all my rosters. however, after much trial and error my boss has changed my direction so I'm moving into different solutions.