Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 07-02-2009, 02:08 PM
amras666 amras666 is offline
Registered User
 
Join Date: 01 Jul 2009
Location: Warsaw, Poland
MS Office Version:Excel 2003
Posts: 1
amras666 is becoming part of the community
Certain field from each sheet as data series for chart

Please Register to Remove these Ads

I want to create a chart that will get a value stored in specific field (always the same) from each sheet of my xls file. I would like it also if descriptions on X axis (January 2009, February 2009... etc.) were taken from sheet names.

Is there any way to do this automatically so I won't have to copy field from each sheet into one sheet, etc.? I just want to have a nice plain chart as one of my sheets (in the tabs in the bottom of excel window), that will update dynamically with each sheet I add.

Thank you in advance
Reply With Quote
  #2  
Old 07-03-2009, 08:59 AM
Andy Pope's Avatar
Andy Pope Andy Pope is offline
Forum Guru
 
Join Date: 10 May 2004
Location: Essex, UK
MS Office Version:2003 & 2007 sp2
Posts: 7,186
Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding Andy Pope Has a higher level of understanding
Re: Certain field from each sheet as data series for chart

Nothing automatic will make that happen.

You will need code at best, formula with manual entry at worst.
__________________
Cheers
Andy
www.andypope.info
Reply With Quote
  #3  
Old 07-03-2009, 09:45 AM
JBeaucaire's Avatar
JBeaucaire JBeaucaire is offline
Forum Guru
 
Join Date: 21 Mar 2008
Location: Bakersfield, CA
MS Office Version:2003 (can read 2007 files)
Posts: 9,439
JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay
Send a message via Skype™ to JBeaucaire
Re: Certain field from each sheet as data series for chart

To help simplify this, here's a little function you can add to your sheet to make an easy list of your sheet names:
Code:
Public Function SheetName(Index As Long)
    If Index <= Sheets.Count Then
        SheetName = Sheets(Index).Name
    Else
        SheetName = ""
    End If
End Function
How to install the UDF:

1. Open up your workbook
2. Get into VB Editor (Press Alt+F11)
3. Insert a new module (Insert > Module)
4. Copy and Paste in your code (given above)
5. Get out of VBA (Press Alt+Q)
6. Save your sheet

The new function is installed and ready to use. It is used like this:

=Sheetname(3)
...gives the sheetname of the third sheet in the book.

To make it so the formula can list all your sheets without you manually changing numbers, in row 1 somewhere enter this:
=Sheetname(ROW())
...then copy that down. When you run out of sheets it will simply return blank cells.

If you decide to start your list in row 5, you need to convert the first value back to "1" to start the list, so that would be:
=Sheetname(ROW()-4)

Make sense so far?

Now, use an INDIRECT() formula to use the list you just created to pull the same cell from the other sheets. Let's say you wanted cell A1 and your list above started in D5, then next to it in E5 put:
=IF(D5 = "", "", INDIRECT("'" & D5 & "'!A1")
...and copy down.

Now you have your data. Highlight it and create your chart.
__________________
If you've been given good help, use the icon in that post to give reputation feedback, it is appreciated.
Always put your code between [code] and [/code] tags.
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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

Forum Jump