Problem with leading zero's, scientific notations, and pasting into a form

%3CLINGO-SUB%20id%3D%22lingo-sub-1620030%22%20slang%3D%22en-US%22%3EProblem%20with%20leading%20zero's%2C%20scientific%20notations%2C%20and%20pasting%20into%20a%20form%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1620030%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20having%20a%20problem%20with%20a%20sheet%20I%20use%20for%20work%2C%20merging%20the%20data%20I%20get%20from%20a%20downloaded%20source%20correctly(also%20an%20excel%20format).%20I%20have%20been%20in%20the%20process%20of%20optimizing%20it%20to%20help%20catch%20errors%20before%20it%20even%20gets%20printed%20and%20have%20run%20into%20some%20roadblocks%20I%20can't%20figure%20out.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20first%20error%20is%20with%20leading%20zeros.%20One%20of%20the%20cells%20is%20a%206%20digit%20number%20that%20identifies%20a%20department%20(org)%20and%20there%20is%20a%20merged%20cell%20at%20the%20top%20of%20the%20page%20that%20shows%20the%20name%20of%20the%20said%20department%20using%20a%20VLOOKUP%20function.%20I%20was%20able%20to%20partially%20correct%20the%20issue%20on%20the%20department%20database%20sheet%20(the%20sheet%20that%20VLOOKUP%20uses%20to%20find%20the%20dept)%20by%20formating%20the%20numbers%20using%20format%20cell%20%26gt%3B%20Number%20%26gt%3B%20Custom%20%26gt%3B%20000000.%20But%20this%20doesn't%20help%20me%20on%20the%20cover%20sheet%20side%20as%20when%20I%20paste%20the%20information%20in%20from%20the%20downloaded%20sheet%20it%20wipes%20out%20any%20cell%20formatting%20I%20had%20in%20place.%20So%20that%20leads%20to%20the%20error%20of%20the%20header%20showing%20the%20wrong%20department%20because%20if%20VLOOKUP%20doesn't%20match%20it%20goes%20to%20the%20closet%20match%20which%20I%20do%20not%20know%20how%20to%20fix.%20I%20have%20set%20some%20conditional%20formatting%20up%20to%20highlight%20any%20cells%20with%20digits%20under%206%20so%20that%20helps%20to%20some%20degree.%20A%20few%20of%20the%20other%20columns%20('E'%203Digits%2C%20'L'-'O'%206%20Digits)%20have%20the%20same%20problem%20just%20to%20a%20lesser%20degree%2C%20when%20I%20paste%20information%20into%20them%20any%20leading%20zeros%20get%20wiped%20out.%20I%20am%20trying%20to%20avoid%20having%20to%20go%20in%20and%20type%20an%20apostrophe%20in%20when%20this%20happens%20to%20convert%20it%20to%20text.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20next%20problem%20is%20of%20a%20similar%20nature%20I%20guess%20when%20I%20paste%20the%20data%20in%20sometimes%20the%20serial%20number%20if%20long%20enough%20is%20converted%20into%20scientific%20notation.%20This%20is%20again%20solved%20by%20simply%20typing%20an%20apostrophe%20but%20I%20would%20like%20to%20avoid%20that%20if%20possible.%20I%20do%20not%20know%20how%20to%20simulate%20a%20scientific%20notation%20on%20the%20attached%20spreadsheet.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1620030%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1620045%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20leading%20zero's%2C%20scientific%20notations%2C%20and%20pasting%20into%20a%20form%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1620045%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20downloaded%20file%20will%20look%20something%20like%20this%20one...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1620103%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20leading%20zero's%2C%20scientific%20notations%2C%20and%20pasting%20into%20a%20form%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1620103%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F773784%22%20target%3D%22_blank%22%3E%40kerry590%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20conditional%20formatting%20doesn't%20change%20the%20actual%20content%20of%20the%20cells%20but%20just%20makes%20them%20'appear'%20different.%20So%20if%20you%20conditionally%20format%20a%20number%20e.g.%20234%20to%20have%20a%20leading%20zero%2C%20if%20will%20look%20show%200234%20in%20the%20cell%20but%20if%20you%20click%20into%20the%20cell%20and%20look%20at%20the%20formula%20bar%20you%20will%20see%20that%20the%20actual%20content%20of%20the%20cell%20is%20still%20234%20and%20not%200234.%20Do%20you%20need%20to%20display%20the%20leading%20zeros%3F%20Are%20they%20in%20the%20original%20file%20you%20are%20copying%20from%3F%20have%20you%20explored%20all%20the%20'paste%20as'%20options%3F%20Are%20you%20just%20pasting%20values%3F%20Finally%2C%20should%20your%20vlookup%20contain%20a%20'true'%20argument%20to%20make%20it%20look%20for%20an%20exact%20match%20only%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1620152%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20leading%20zero's%2C%20scientific%20notations%2C%20and%20pasting%20into%20a%20form%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1620152%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F773784%22%20target%3D%22_blank%22%3E%40kerry590%3C%2FA%3E%26nbsp%3BHi%20I%20have%20tried%20to%20replicate%20your%20problem%20by%20pasting%20the%20data%20into%20the%20cover%20sheet%20but%20none%20of%20the%20values%20caused%20any%20issue.%20What%20formatting%20do%20the%20numbers%20actually%20have%20when%20they%20appear%3F%20Are%20they%20formatted%20as%20numbers%20or%20general%3F%20In%20which%20case%20I%20don't%20understand%20how%20the%20vlookup%20wouldn't%20find%20it..%20Have%20you%20considered%20pasting%20only%20the%20values%20rather%20than%20values%20and%20formatting%3F%20Also%2C%20have%20you%20considered%26nbsp%3B%20pulling%20the%20data%20from%20another%20sheet%20into%20the%20cover%20sheet%20using%20formulas%20to%20ensure%20consistency%3F%20you%20could%20pull%20all%20the%20values%20you%20need%20as%20number%20through%20using%20the%20convert%20from%20text%20formula%20(value())%20and%20make%20sure%20that%20the%20cells%20are%20correctly%20formatted%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1620181%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20leading%20zero's%2C%20scientific%20notations%2C%20and%20pasting%20into%20a%20form%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1620181%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F773784%22%20target%3D%22_blank%22%3E%40kerry590%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20department%20list%20you%20may%20convert%20numbers%20to%20texts%20such%20way%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20431px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215305iD593E5EA1505CCEE%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Eand%20use%20column%20with%20formulas%20as%20lookup%20array%2C%20values%20here%20will%20be%20kept%20as%20texts.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20downloaded%20file%20ORG%20are%20initially%20without%20leading%20zero%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20146px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215306i6B7E1DCD2A99F4EA%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Ebut%20even%20if%20they%20are%2C%20with%20opening%20csv%20file%20in%20Excel%20they%20are%20automatically%20converted%20to%20numbers%2C%20i.e.%20values%20without%20leading%20zeroes.%20To%20lookup%20them%20in%20departments%20list%20with%20texts%20as%20departments%20you%20may%20use%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DVLOOKUP(TEXT(L6%2C%22000000%22)%2CDepartments!B2%3AC116%2C2%2CFALSE)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Eand%20I'd%20recommend%20to%20use%20FALSE%20as%20last%20parameter%2C%20i.e.%20use%20exact%20match%20instead%20of%20approximate%20one.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

I am having a problem with a sheet I use for work, merging the data I get from a downloaded source correctly(also an excel format). I have been in the process of optimizing it to help catch errors before it even gets printed and have run into some roadblocks I can't figure out.

 

The first error is with leading zeros. One of the cells is a 6 digit number that identifies a department (org) and there is a merged cell at the top of the page that shows the name of the said department using a VLOOKUP function. I was able to partially correct the issue on the department database sheet (the sheet that VLOOKUP uses to find the dept) by formating the numbers using format cell > Number > Custom > 000000. But this doesn't help me on the cover sheet side as when I paste the information in from the downloaded sheet it wipes out any cell formatting I had in place. So that leads to the error of the header showing the wrong department because if VLOOKUP doesn't match it goes to the closet match which I do not know how to fix. I have set some conditional formatting up to highlight any cells with digits under 6 so that helps to some degree. A few of the other columns ('E' 3Digits, 'L'-'O' 6 Digits) have the same problem just to a lesser degree, when I paste information into them any leading zeros get wiped out. I am trying to avoid having to go in and type an apostrophe in when this happens to convert it to text. 

 

The next problem is of a similar nature I guess when I paste the data in sometimes the serial number if long enough is converted into scientific notation. This is again solved by simply typing an apostrophe but I would like to avoid that if possible. I do not know how to simulate a scientific notation on the attached spreadsheet.

 

4 Replies

The downloaded file will look something like this one...

@kerry590 

 

Hi

 

The conditional formatting doesn't change the actual content of the cells but just makes them 'appear' different. So if you conditionally format a number e.g. 234 to have a leading zero, if will look show 0234 in the cell but if you click into the cell and look at the formula bar you will see that the actual content of the cell is still 234 and not 0234. Do you need to display the leading zeros? Are they in the original file you are copying from? have you explored all the 'paste as' options? Are you just pasting values? Finally, should your vlookup contain a 'true' argument to make it look for an exact match only?

@kerry590 Hi I have tried to replicate your problem by pasting the data into the cover sheet but none of the values caused any issue. What formatting do the numbers actually have when they appear? Are they formatted as numbers or general? In which case I don't understand how the vlookup wouldn't find it.. Have you considered pasting only the values rather than values and formatting? Also, have you considered  pulling the data from another sheet into the cover sheet using formulas to ensure consistency? you could pull all the values you need as number through using the convert from text formula (value()) and make sure that the cells are correctly formatted?

@kerry590 

In department list you may convert numbers to texts such way

image.png

and use column with formulas as lookup array, values here will be kept as texts.

 

In downloaded file ORG are initially without leading zero

image.png

but even if they are, with opening csv file in Excel they are automatically converted to numbers, i.e. values without leading zeroes. To lookup them in departments list with texts as departments you may use

=VLOOKUP(TEXT(L6,"000000"),Departments!B2:C116,2,FALSE)

and I'd recommend to use FALSE as last parameter, i.e. use exact match instead of approximate one.