Heading is converted to date when all i wanted was [1-10] representing days overdue

Copper Contributor

hi, i copied the result set of an account receivable "aging" query run in ssms over to excel.  Column heading might be something like Current, [1-10] ,[11-30],[31-60]...[>=181] representing the $'s owed by customers slotted into how long overdue they are.  Every heading except [1-10] and [11-30] were fine.  These 2 converted to nonsensical dates upon paste to excel.  I poked around looking for a way to rename them and got into some sort of wild goose chase where excel already thought they had names starting with an underscore that i wasnt allowed to change.  Can somebody help?  I really like this look for headings.  I tried putting blanks before and after the dashes to no avail. 

2 Replies

@db042190_1 

It sounds like Excel is automatically interpreting the headings [1-10] and [11-30] as dates due to their format. To prevent Excel from converting them to dates, you can precede the headings with an apostrophe ', which tells Excel to treat the content as text.

Here's what you can do:

  1. Insert Apostrophe:
    • Click on the cell containing the heading [1-10].
    • In the formula bar or directly in the cell, type ' (apostrophe) before [1-10].
    • Repeat the same for [11-30] and any other headings that Excel is converting to dates.
  2. Format as Text:
    • After inserting the apostrophe, Excel should treat the content as text.
    • You can format the cell to remove the apostrophe and any leading spaces if desired.

By preceding the headings with an apostrophe, Excel will recognize them as text and won't attempt to convert them to dates. This should resolve the issue of nonsensical dates appearing in your column headings.

 

My answers are voluntary and without guarantee!

 

Hope this will help you.

 

Was the answer useful? Mark as best response and like it!

This will help all forum participants.

@db042190_1 

Not sure how query is run in SSMS, but why don't you use Power Query to import data from SQL server?