PC Review


Reply
 
 
James8309
Guest
Posts: n/a
 
      9th Jul 2008
Hi everyone

I have different digit of numbers in column B and I am trying to use
"if" and " concatenate" statement together but it creates an error.

=IF(LEN(B3)=5,CONCATENATE("CB0010",B3),IF(LEN(B3)=4,CONCATENATE("CB00100",B3),IF(LEN(B3)=3,CONCATENATE("CB001000",B3),"")))

if I just go if(len(b3)=5,concatenate("CB0010",b3),"") then it works
fine but above formula returns 0

can anyone help?


thank you


regards,


James
 
Reply With Quote
 
 
 
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      9th Jul 2008
It is always a good idea to explain **what** error you are getting rather
than to just say you got an error. I see nothing wrong wrong with your
formula and when I tried it out, it worked fine... I got no errors. By the
way, you do not need to use the CONCATENATE formula for such simple
concatenations, you can just use an ampersand (&) to concatenate the text.
So, your formula can be reduced to this...

=IF(LEN(B3)=5,"CB0010"&B3,IF(LEN(B3)=4,"CB00100"&B3,IF(LEN(B3)=3,"CB001000"&B3,"")))

Rick


"James8309" <(E-Mail Removed)> wrote in message
news:59637079-fa0d-499b-a17e-(E-Mail Removed)...
> Hi everyone
>
> I have different digit of numbers in column B and I am trying to use
> "if" and " concatenate" statement together but it creates an error.
>
> =IF(LEN(B3)=5,CONCATENATE("CB0010",B3),IF(LEN(B3)=4,CONCATENATE("CB00100",B3),IF(LEN(B3)=3,CONCATENATE("CB001000",B3),"")))
>
> if I just go if(len(b3)=5,concatenate("CB0010",b3),"") then it works
> fine but above formula returns 0
>
> can anyone help?
>
>
> thank you
>
>
> regards,
>
>
> James


 
Reply With Quote
 
Ron Rosenfeld
Guest
Posts: n/a
 
      9th Jul 2008
On Wed, 9 Jul 2008 00:07:11 -0700 (PDT), James8309 <(E-Mail Removed)>
wrote:

>Hi everyone
>
>I have different digit of numbers in column B and I am trying to use
>"if" and " concatenate" statement together but it creates an error.
>
>=IF(LEN(B3)=5,CONCATENATE("CB0010",B3),IF(LEN(B3)=4,CONCATENATE("CB00100",B3),IF(LEN(B3)=3,CONCATENATE("CB001000",B3),"")))
>
>if I just go if(len(b3)=5,concatenate("CB0010",b3),"") then it works
>fine but above formula returns 0
>
>can anyone help?
>
>
>thank you
>
>
>regards,
>
>
>James


Your formula works OK for me.

What error do you get?

Is the data in B3 within the range 100-99999?

If the data in B3 will always be a number, the formula below is equivalent:

=IF(OR(B3>99999,B3<100),"",TEXT(B3,"""CB0010""00000"))
--ron
 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      9th Jul 2008
First, I don't use the =concatenate() function. It takes too long to type and
could eat up a function call in a long expression.

I use the & operator:
=concatenate("cb0010",b3)
is the same as:
="cb0010"&b3

Another posibility for both numbers and text:
=IF(OR(LEN(B3)<3,LEN(B3)>5),"","CB0010"&REPT("0",5-LEN(B3))&B3)



James8309 wrote:
>
> Hi everyone
>
> I have different digit of numbers in column B and I am trying to use
> "if" and " concatenate" statement together but it creates an error.
>
> =IF(LEN(B3)=5,CONCATENATE("CB0010",B3),IF(LEN(B3)=4,CONCATENATE("CB00100",B3),IF(LEN(B3)=3,CONCATENATE("CB001000",B3),"")))
>
> if I just go if(len(b3)=5,concatenate("CB0010",b3),"") then it works
> fine but above formula returns 0
>
> can anyone help?
>
> thank you
>
> regards,
>
> James


--

Dave Peterson
 
Reply With Quote
 
New Member
Join Date: Jul 2008
Posts: 3
 
      9th Jul 2008
How about this?

=LEFT("CB001000",11-LEN(B3))&B3

David Rose


Quote:
Originally Posted by Dave Peterson
First, I don't use the =concatenate() function. It takes too long to type and
could eat up a function call in a long expression.

I use the & operator:
=concatenate("cb0010",b3)
is the same as:
="cb0010"&b3

Another posibility for both numbers and text:
=IF(OR(LEN(B3)<3,LEN(B3)>5),"","CB0010"&REPT("0",5-LEN(B3))&B3)



James8309 wrote:
>
> Hi everyone
>
> I have different digit of numbers in column B and I am trying to use
> "if" and " concatenate" statement together but it creates an error.
>
> =IF(LEN(B3)=5,CONCATENATE("CB0010",B3),IF(LEN(B3)=4,CONCATENATE("CB00100",B3),IF(LEN(B3)=3,CONCATENATE("CB001000",B3),"")))
>
> if I just go if(len(b3)=5,concatenate("CB0010",b3),"") then it works
> fine but above formula returns 0
>
> can anyone help?
>
> thank you
>
> regards,
>
> James


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem after problem after problem - winXP wont start! =?Utf-8?B?TWF2aXJpY2s=?= Windows XP Help 2 23rd Apr 2006 03:55 PM
Microsoft Access Object Library Version Problem (Form VBA Code Problem) Don Microsoft Access Form Coding 2 8th Mar 2004 02:00 PM
hibernation problem! problem!, Power Option problem! Farzad Hayati Microsoft Windows 2000 Hardware 2 5th Feb 2004 11:22 PM
hibernation problem! problem!, Power Option problem! Farzad Hayati Microsoft Windows 2000 Advanced Server 2 5th Feb 2004 11:22 PM
Outlook 2002 connector: problem connecting with Domino server because of NAMELookup2 problem Jean-Paul Smeets Microsoft Outlook 2 26th Sep 2003 11:17 AM


Features
 

Advertising
 

Newsgroups
 


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