Here's a tricky one!

dantheram

Board Regular
Joined
Aug 27, 2010
Messages
192
Office Version
  1. 365
Platform
  1. Windows
I'll try to explain this the best i can so bear with me!

Aim - to create a graph where the end user chooses the data to be displayed.

Progress - I have created the base graph and inserted a drop down menu, directly above containing the desired parameters. When the drop down is changed it triggers a vlookup to change the data in the cells where the graph reads from.

Problem - i can select parameter 1, 2 an 3 but 4 is designed to be ALL i.e. 1,2,3 combined. How can i get my vlookup to display data from 1,2 an 3 in the area where the graph reads from?

Hope that makes sense.
 
Something like this...

Using row 1 as the series header (1,2,3)

-------1----2----3
Fred---x----x----x
Bill---x----x----x
John---x----x----x

So the formula for the first 'x' would be (then drag across and down)


'Y' = dropdown cell value (1-4)


=IF('Y'=4,values formula,IF(B$1<>'Y',#N/A,values formula))
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Well you'd need VBA to switch from a single series chart to a 3 series chart. Right-click the sheet tab, View Code, and copy this code in .... adjusting for your case of course:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$G$2" Then
    If Target.Value = 4 Then
         Me.ChartObjects(1).Chart.SetSourceData _
            Source:=Me.Range("A1:D4"), PlotBy:=xlColumns
    Else
         Me.ChartObjects(1).Chart.SetSourceData _
            Source:=Me.Range("A1:B4"), PlotBy:=xlColumns
         Me.ChartObjects(1).Chart.SeriesCollection(1).Formula = _
        "=SERIES('" & ThisWorkbook.Name & "'!myseriestitle,Sheet1!R2C1:R4C1,'" & ThisWorkbook.Name & "'!mysource,1)"
 
    End If
End If
End Sub

This is operating on a sheet with this layout:

Excel Workbook
ABCDEFG
1Val1Val2Val3Series
2Fred2224551
3Bill332556
4John442658
Sheet10


... and these names:
myseriestitle =OFFSET(Sheet10!$B$1,0,Sheet10!$G$2-1,1,1)
mysource =OFFSET(Sheet10!$B$2,0,Sheet10!$G$2-1,3,1)



ok, now i'm going to look really silly. i've opened a new workbook and tried to set up the above example, with the exact same data in the exact same places.

I have clicked view code and entered the VBA but what do i do now?
 
Upvote 0
Have you saved the workbook? What's the sheet name within the book where your chart and data is? Have you created the defined names for the series title and series data?
 
Upvote 0
Something like this...

Using row 1 as the series header (1,2,3)

-------1----2----3
Fred---x----x----x
Bill---x----x----x
John---x----x----x

So the formula for the first 'x' would be (then drag across and down)


'Y' = dropdown cell value (1-4)


=IF('Y'=4,values formula,IF(B$1<>'Y',#N/A,values formula))


this looks like it would work also but i can't follow how to plug it in. i cannot upload anything from work, sorry.
 
Upvote 0
Have you saved the workbook? What's the sheet name within the book where your chart and data is? Have you created the defined names for the series title and series data?


sorted, thanks very much for this Glenn!
 
Upvote 0

Forum statistics

Threads
1,224,559
Messages
6,179,517
Members
452,921
Latest member
BBQKING

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top