Hi!
I have an Excel 2016 worksheet with a data connection to db where I query contents to Excel. It is a simple table with invoice numbers and due dates. Those are exclusively unpaid overdue invoices. SQL query identifies if the invoice is open (unpaid). The date is kept as a decimal in the database and has a format YYYYMMDD
A1 cell in my workbook is equipped with a formula =TEXT(TODAY(); "yyyymmdd") - it displays the current date in the same format. The query uses value in this cell to identify if the open invoice is overdue (i.e. Due date is smaller than A1 value). This is done via table parameters setup. This works like a charm - I only get invoices in my table that are open + are past the due date.
I'm struggling to calculate the correct number of days overdue though. I have created an extra column to the table with formula "=A$1 - Due Date", however the format does not support correct calculations. E.g. on November 1st for an invoice with due date on October 1st the calculating process would work =20181101 - 20181001 = 100 days, which obviously isn't correct.
SQL query would not allow me to use CAST function to turn decimal value to DATE and I can't really mess around with the date format in cell A1 to keep it functional for query purposes.
I guess I'm looking for options how to turn value YYYYMMDD into properly formatted date in a helper column, which would be usable in formulas? How could I do that or are there alternative approaches?
Thanks!
I have an Excel 2016 worksheet with a data connection to db where I query contents to Excel. It is a simple table with invoice numbers and due dates. Those are exclusively unpaid overdue invoices. SQL query identifies if the invoice is open (unpaid). The date is kept as a decimal in the database and has a format YYYYMMDD
A1 cell in my workbook is equipped with a formula =TEXT(TODAY(); "yyyymmdd") - it displays the current date in the same format. The query uses value in this cell to identify if the open invoice is overdue (i.e. Due date is smaller than A1 value). This is done via table parameters setup. This works like a charm - I only get invoices in my table that are open + are past the due date.
I'm struggling to calculate the correct number of days overdue though. I have created an extra column to the table with formula "=A$1 - Due Date", however the format does not support correct calculations. E.g. on November 1st for an invoice with due date on October 1st the calculating process would work =20181101 - 20181001 = 100 days, which obviously isn't correct.
SQL query would not allow me to use CAST function to turn decimal value to DATE and I can't really mess around with the date format in cell A1 to keep it functional for query purposes.
I guess I'm looking for options how to turn value YYYYMMDD into properly formatted date in a helper column, which would be usable in formulas? How could I do that or are there alternative approaches?
Thanks!
Last edited: