Hi Regina,

The problem seems to be that XL has dropped off the leading zeros, so sometimes 
your data is 6 characters long, and sometimes just 5.

When the data is 6 characters long, you need MID(E2,1,4)

But when the data is only 5 characters long, you need MID(E2,1,3)

(Since you aren't using 24 hour notation, you should never have the possibility 
of less than 5 characters.)

Try using an "IF" statement to sort this out:

IF(LEN(E2)=6,MID(E2,1,4),MID(E2,1,3))

I notice that you have used ";" where I use "," which is a regional thing. You 
will have to change my formula accordingly.

Regards - Dave.

 

 

 
> Date: Tue, 22 Jun 2010 14:20:50 +0200
> Subject: Re: $$Excel-Macros$$ Help
> From: regina.medha...@gmail.com
> To: excel-macros@googlegroups.com
> 
> I am using the MID function for two columns which contains times and
> moslty it works
> 
> EgEg. the first column contains 111030, ie , 9 o'clock 10 minute and
> 30 second , and the second column 112930 that is 11 o'clock 29 minute
> and 30 second.
> 
> I want to reduce the data and show only hour and minute so I used the
> mid function MID(E2;1;4) so the first one will be 1103 and second
> 1129. And I subtract the second from the first and got 26 minute.
> 
> But in some rows the first column contains 91030, ie , 9 o'clock 10
> minute and 30 second , and the second column 112930 that is 11
> o'clock 29 minute and 30 second and the first one will be 9103 and
> second 1129. but the result will be wrong.
> 
> Do any one knows an alternative function in excel whick can work for
> this purpose.
> 
> Thanks for your help in advance.
> 
> Regina
> 
> -- 
> ----------------------------------------------------------------------------------
> Some important links for excel users:
> 1. Follow us on TWITTER for tips tricks and links : 
> http://twitter.com/exceldailytip
> 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
> 3. Excel tutorials at http://www.excel-macros.blogspot.com
> 4. Learn VBA Macros at http://www.quickvba.blogspot.com
> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
> 
> To post to this group, send email to excel-macros@googlegroups.com
> 
> <><><><><><><><><><><><><><><><><><><><><><>
> HELP US GROW !!
> 
> We reach over 7000 subscribers worldwide and receive many nice notes about 
> the learning and support from the group.Let friends and co-workers know they 
> can subscribe to group at 
> http://groups.google.com/group/excel-macros/subscribe
                                          
_________________________________________________________________
Need a new place to live? Find it on Domain.com.au
http://clk.atdmt.com/NMN/go/157631292/direct/01/

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 7000 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Reply via email to