Link to home
Start Free TrialLog in
Avatar of WJM
WJMFlag for United States of America

asked on

Help on Excel formula to increase invoice number based on date change

I have an excel spreadsheet that I use for invoicing a client.  I would like to create an "if then" formula so that when a date changes in one of the cells, the cell that contains the invoice number will increment by 1.

For example, my date is 01/01/2013 and my invoice number is 2013-001.  What I would like to happen is that anytime the date changes, the invoice will automatically update, so if the next time I open this file and the date changes to 01/04/2013 then I would like the invoice number to automatically update to 2013-002, hopefully this makes sense, thank you.
ASKER CERTIFIED SOLUTION
Avatar of Robberbaron (robr)
Robberbaron (robr)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WJM

ASKER

Yes, that's it baron; however, how do I get the Sub codes to work properly, I'm not an expert at Excel and though I see how the cells are working in your sample you provide I do not know how to duplicate that in my Excel file, thank you.
you need to open the devloper tab.  Copy and paste the code in to your workbook.

The Workbook_SheetChange sub goes into the Workbook object.
Need to create a user module for the other code. (one way is to record a macro).

And then create the named ranges to suit your workbook.
Avatar of tweakmasters
tweakmasters

There are few more thing that need to be clarified before your can apply a good patch for your problem. Can you please clarify if you have only one sheet where you want the number changed accordingly to date or do you open multiple sheets (do you keep or discard previous invoice records)? From your description seems like you don't keep previous records.
Avatar of WJM

ASKER

tweakmasters, it is only one sheet.  I update that sheet, save it, save to PDF and close, the next week I open up the previous weeks excel file, update it with the current weeks information and do the save and close process again.  Records are kept as PDF's but the Excel file is always updated...
my invoice workbook is surprisingly similar. I have done the PDF creation as a macro that saves the PDF with a date in filename.
Avatar of WJM

ASKER

Thank you very much.