Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Excel Formula - How to increment alphanumeric column by 1

Posted on 2016-07-27
4
Medium Priority
?
367 Views
Last Modified: 2016-07-27
Excel knowledge, programming knowledge, scripting knowledge - novice, beginner level.

Hello all

I'm using Excel 2016, Windows 10.  And I need to create some SKU numbers. The ask is to be able to auto increment my SKU in the column A by 1.

My SKU pattern is MPSK-00001-001.  The prefix of the pattern is constant "MPSK". I only interested in increment the middle part of the pattern the "00001" portion of the pattern, not the suffix of the pattern at this time. The dashes are part of the pattern and must be retained. And finally must retain leading zeros, padding zeros.

The datasheet that I have in Excel I can not add more columns.  So I need to apply the formula starting from column N, and carry it forward to however far I need to drag it down in the future as the list grows.  And the kicker is that I only need a SKU number created if there is a description in column D, non-blank in column D. Meaning not every row in my excel file needs to have a SKU added.

So I filtered column D to exclude blanks.  And I applied this formula to column N ="MPSK-"&TEXT(ROWS(1:$2),"00000")&"-001"  ... which didn't give me the results I was seeking though I think I am close maybe?  Image of result attached.

invalid SKU results
Desired output would be where column D isn't blank to increment the SKU value in column N by 1.
row 1, column N contains MPSK-00001-001
if column D isn't blank then column N ....MPSK-00002-001
if column D isn't blank then column N ....MPSK-00003-001
if column D isn't blank then column N ....MPSK-00004-001
if column D isn't blank then column N ....MPSK-00005-001
desired SKU results
Note: that in my print screen examples there appears to be (5) rows related to each product that requires a SKU, this is just due to the subset I grabbed the screenshot.  The attributes/rows between products can vary, it is not a constant (5) rows ... hopefully that makes sense.

Thanks in advance for the assistance.
0
Comment
Question by:mrrmpc
[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
  • 2
  • 2
4 Comments
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 2000 total points
ID: 41732303
at column N2, try use this formula:
=IF(D2="","", "MPSK-" & TEXT(COUNTA($D$2:D2),"00000")&"-001")

Open in new window

and drag down this formula for the following rows.
0
 

Author Comment

by:mrrmpc
ID: 41732328
Hi Ryan

Thanks for the quick reply.  There was a typo in my original question.

Incorrect statement:
The ask is to be able to auto increment my SKU in the column A by 1.

Corrected statement:
The ask is to be able to auto increment my SKU in the column N(variant sku) by 1. When column D (vendor) has a value, is not blank.

I attempted as you suggested this produced a #NAME?error.
=IF(D2="","", "MPSK-" & TEXT(COUNTA($D$2:D2),"00000")&"-001")
0
 

Author Closing Comment

by:mrrmpc
ID: 41732351
Thanks for the assistance.  There was no error in your response, I didn't apply it correctly I was in the wrong cell, my apologies.

Your response was spot on.  Thanks for the quick assistance Ryan.
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 41732376
you're welcome, no worries, glad could make help cheers
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

662 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