?
Solved

coding if logic on number pattern

Posted on 2011-03-16
6
Medium Priority
?
498 Views
Last Modified: 2012-05-11
Dear experts,

I am a bit new to Excel 2007 and I am trying to figure out how to create a formula to add 7 to the previous number if the number in the tens place is not the same as the previous number in the tens place. If it is then add 17 to the code. Here is a sample number pattern:

0026
0033
0040
0057
0064
0071
0088
0095
0101
0118
0125
0132
0149
0156
0163
0170
0187
0194
0200

I am entering a ton of certified mail tickets and seems the last four of the ticket number has this pattern. Knowing a formula to autofill would save me a ton of time.

I have attached a sample spreadhsheet. I could easily code a formula to add seven but get stuck when I try to if logic to check the tens place.

Thanks!



Certified-Reciepts.xlsx
0
Comment
Question by:shogun5
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
ID: 35152949
See the attached. Did I interpret your question correctly?

Kevin
Certified-Reciepts.xlsx
0
 

Author Comment

by:shogun5
ID: 35152961
zorvek:

No. Please see screenshot. The tens place apparently cannot repeat. I suppose if the formula is correct you could type 0026 in the first cell and then use the formula populate subsequent cells and the numbers under D should be identical.
excel-screenshot.jpg
0
 
LVL 81

Accepted Solution

by:
zorvek (Kevin Jones) earned 1000 total points
ID: 35152968
This should work:

   =D2+7+IF(TRUNC((D2+7)/10)-TRUNC(D2/100)*100=TRUNC(D2/10)-TRUNC(D2/100)*100,10,0)

Kevin
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Closing Comment

by:shogun5
ID: 35152974
Cool! Thanks!
0
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
ID: 35152975
See attached.

Kevin
Certified-Reciepts.xlsx
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 35152983
Here's a shorter option

=D2+7+(MOD(D2,10)<3)*10

regards, barry
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question