Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
pm pm is offline
external usenet poster
 
Posts: 122
Default include sheet name in formula

I have multiple sheets in a file and i'm trying to include the sheet name in
a cell with a formula but not sure if this can be done - for instance:

Company Vendor Date Invoice
1 1179 20100515 20100515Janitorial

in this example in the invoice column i want to include the date and the
sheet name. Thanks for any assistance.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,069
Default include sheet name in formula

One way is to use INDIRECT with this Harlan-inspired technique to return the
active sheetname. Note: Workbook must be saved first

Select cell A1 (important!)
Click Insert Name Define
(in XL2007, it's Formula ribbon Defined Names section Define Name)
Put under "Names in workbook:": WSN
(in XL2007, Name=WSN, Scope=Workbook)
Put in the "Refers to:" box:
=MID(CELL("Filename",INDIRECT("A1")),FIND("]",CELL("Filename",INDIRECT("A1")))+1,32)
Click OK

The above defines WSN as a name we can use to refer to the sheetname in any
sheet. It will auto-extract the sheetname implicitly. Eg, if you enter: =WSN
in any sheet, any cell, it'll return the sheetname in that cell.

If the first invoice cell on your worksheet is D2, its formula would then be:
=C2&WSN

Hope this helps,

Hutch

"pm" wrote:

I have multiple sheets in a file and i'm trying to include the sheet name in
a cell with a formula but not sure if this can be done - for instance:

Company Vendor Date Invoice
1 1179 20100515 20100515Janitorial

in this example in the invoice column i want to include the date and the
sheet name. Thanks for any assistance.

  #3   Report Post  
Posted to microsoft.public.excel.misc
pm pm is offline
external usenet poster
 
Posts: 122
Default include sheet name in formula

Thanks Hutch! This is cool!

"Tom Hutchins" wrote:

One way is to use INDIRECT with this Harlan-inspired technique to return the
active sheetname. Note: Workbook must be saved first

Select cell A1 (important!)
Click Insert Name Define
(in XL2007, it's Formula ribbon Defined Names section Define Name)
Put under "Names in workbook:": WSN
(in XL2007, Name=WSN, Scope=Workbook)
Put in the "Refers to:" box:
=MID(CELL("Filename",INDIRECT("A1")),FIND("]",CELL("Filename",INDIRECT("A1")))+1,32)
Click OK

The above defines WSN as a name we can use to refer to the sheetname in any
sheet. It will auto-extract the sheetname implicitly. Eg, if you enter: =WSN
in any sheet, any cell, it'll return the sheetname in that cell.

If the first invoice cell on your worksheet is D2, its formula would then be:
=C2&WSN

Hope this helps,

Hutch

"pm" wrote:

I have multiple sheets in a file and i'm trying to include the sheet name in
a cell with a formula but not sure if this can be done - for instance:

Company Vendor Date Invoice
1 1179 20100515 20100515Janitorial

in this example in the invoice column i want to include the date and the
sheet name. Thanks for any assistance.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create new sheet for each row and include header Sabosis Excel Worksheet Functions 1 September 4th 09 03:34 PM
How to make the scrolling not include the top rows of the sheet Magrano Excel Discussion (Misc queries) 3 August 3rd 07 06:18 AM
To include the name of files from a folder to the excel sheet anil Excel Discussion (Misc queries) 1 January 17th 07 09:43 AM
How do I add cells to a balance sheet which will include new sum? Karen Excel Discussion (Misc queries) 3 September 13th 06 08:59 PM
How to include data on the same sheet some in database some not Edify Excel Worksheet Functions 0 May 18th 06 09:28 PM


All times are GMT +1. The time now is 11:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"