Dear Mike,

Below is the formula for your requirement.

=IF(AND(A2="abcdCust",LEN(B2)=6),0&B2,IF(AND(A2="xyzzCust",LEN(B2)=8),LEFT(B2,4)&"-"&RIGHT(B2,4),""))

Solved workbook is also attached.

Best Regards,
-- 
DILIP KUMAR PANDEY
   MBA-HR,B COM(Hons.),BCA
Mobile: +91 9810929744
dilipan...@gmail.com
dilipan...@yahoo.com
New Delhi - 110062


On 12/1/09, mike <mwillia...@socal.rr.com> wrote:
>
> I have a set of data in Excel 2003 that is like this:
>
> Customer  OrderNum
> abcdCust  234567
> xyzzCust  12345678
> ...thousands of order entries, I'm just showing 2 taht are problems
> for me.
>
>
> The first customer needs to have a padded 7 digit order number as
> "0234567"
> The second needs a dash placed between the first 4 and the last 4 like
> "1234-5678"
>
> So, what I need is something like this:
>
> if cell a1="abcdCust" AND len(b1)=6 then change (b1) to pad (b1) with
> zero
> if cell a1="xyzzCust" and len(b1) = 8 then change (b1) to add dash to
> (b1) after the first 4.
> next cell to evaluate a2...loop back until a(x) is blank.
>
> Not all of my customers are these two(the only two with these issues),
> so if both if statements evaluate to false, then just move on.
>
> I'm fairly up to speed with VBA, just not with excel and cell value
> evaluation.
> Any help will be appreciated.
>
>
>
>
> --
>
> ----------------------------------------------------------------------------------
> Some important links for excel users:
> 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at
> http://www.excelitems.com
> 2. Excel tutorials at http://www.excel-macros.blogspot.com
> 3. Learn VBA Macros at http://www.vbamacros.blogspot.com
> 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
>
>
> To post to this group, send email to excel-macros@googlegroups.com
> If you find any spam message in the group, please send an email to:
> Ayush Jain  @ jainayus...@gmail.com or
> Ashish Jain @ 26may.1...@gmail.com
> <><><><><><><><><><><><><><><><><><><><><><>
> HELP US GROW !!
>
> We reach over 6,500 subscribers worldwide and receive many nice notes about
> the learning and support from the group. Our goal is to have 10,000
> subscribers by the end of 2009. Let friends and co-workers know they can
> subscribe to group at
> http://groups.google.com/group/excel-macros/subscribe

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe

Attachment: IF Statement-by DILipandey.xls
Description: MS-Excel spreadsheet

Reply via email to