Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Can I do this? (Excel Formula)

Thread Tools
 
Search this Thread
 
Old 14 July 2004, 03:51 PM
  #1  
Fig
Scooby Regular
Thread Starter
 
Fig's Avatar
 
Join Date: Aug 2002
Location: not forgetting 20,000 posts from last time ;)
Posts: 5,806
Likes: 0
Received 0 Likes on 0 Posts
Default Can I do this? (Excel Formula)

D2 contains a telephone number. I need to check the length of the number in cell D2. If 10 or more digits, I need to E2 to display the last 10 adding a preceding 0, otherwise E2 should display the full contents of D2.

I tried entering this in E2

IF((LEN(D2)>=10),CONCATENATE(0,(RIGHT(D2,10),D2)))

but the ever so helpful Office Assistant says I have an error in the formula. I can't see anything obvious. Do I need to do this is two stages, i.e. extract the first 10 digits first, then do the concatenate bit?
Old 14 July 2004, 04:09 PM
  #2  
greyarea
Scooby Regular
 
greyarea's Avatar
 
Join Date: Nov 2001
Posts: 48
Likes: 0
Received 0 Likes on 0 Posts
Default

If I read your explanation correctly, the last D2 is supposed to be part of the IF statement, but your brackets have made it part of the CONCATENATE. I think you have an extra, unnecessary, set of brackets that is confusing things.

=IF((LEN(D2)>=10),CONCATENATE(0,RIGHT(D2,10)),D2)
Old 14 July 2004, 05:24 PM
  #3  
Fig
Scooby Regular
Thread Starter
 
Fig's Avatar
 
Join Date: Aug 2002
Location: not forgetting 20,000 posts from last time ;)
Posts: 5,806
Likes: 0
Received 0 Likes on 0 Posts
Default

Brilliant

Thanks for the help
Old 14 July 2004, 08:16 PM
  #4  
dsmith
Scooby Regular
 
dsmith's Avatar
 
Join Date: Mar 1999
Posts: 4,518
Likes: 0
Received 0 Likes on 0 Posts
Default

You can use "&" instead of concatenate to join strings. makes formula easier to read I find.

=IF((LEN(D2)>=10),"0" & RIGHT(D2,10),D2)

Deano
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Mattybr5@MB Developments
Full Cars Breaking For Spares
28
28 December 2015 11:07 PM
Mattybr5@MB Developments
Full Cars Breaking For Spares
12
18 November 2015 07:03 AM
leg200
Subaru Parts
5
07 October 2015 07:31 AM
Ganz1983
Subaru
5
02 October 2015 09:22 AM



Quick Reply: Can I do this? (Excel Formula)



All times are GMT +1. The time now is 06:07 PM.