Spin button for showing Month by Month on Chart Graph - excel

So i have the template layout in the picture attached below. I would like to know how to link the Spin button to able to show month by month when i click on the spin button.
Here is the formula i have so far, everything working fine except for the chart doesn't connect to the spin.
E4 formula : ="Monthly "&E5&" - Audit Sheet Delivery"
data for eat month for LATE row:=IFERROR(VLOOKUP(G3,$A$4:$C$6000,2,FALSE)," ")
Same for On-Time:=IFERROR(VLOOKUP(G3,$A$4:$C$6000,3,FALSE)," ")
Spin button link to cell $E$5
I have created define name for each Month, Late and On-Time and linked it to the chart but it doesn't work.
Please point out what i have to do in this case. Also, please show the code on here due to i am new to this. Thanks

Thanks you all for your help. I did figure out one way to make it work for me. However, i will more than happy to learn new way or a better way to use spin button and scroll button to changing my chart.
Changes data layout table
Using index formula and vlookup (Cell F19, G19,H19) formula included in picture below)
Changes define name formula to pull data from Cell (Cell F19, G19,H19).
Now i can click on my spin button and the chart changing month by month for me.
It is working fine for me. But i love to learn more if anyone can show me a better way to do it. Please include pictures and formula in your answer. It will help me and other easy to follow it. Thanks

How to do anything anything Excel can do, but with VBA code:
Virtually anything you can do manually in Excel (ie, via the ribbons/toolbars) has an equivalent in VBA.
If you are unsure of which VBA method or property to use, you can turn on the macro recorder and manually perform the action. The macro recorder translates your actions into Visual Basic code. After you record your actions, you can modify the code to do exactly what you want.
There are some limitations to recording macros, so if needed, certain actions have to be added after recording, such as conditional branches (eg., IF statements), variables usage loops, error handling, and text selections made with the mouse (however keyboard combinations do record).
Record an action:
For example, if you want to automate the process of saving the file with a new name, but you don't know which property or method to use, you could do this:
On the Developer ribbon, click
Change the default macro name to a name of your choice and click OK to start the recorder.
Hit F12 to open the Save As... dialog and save the file with a new name.
On the Developer ribbon, click
On the Developer ribbon, click Macros.
Select the macro name that you assigned (in Step 2) and click to view the VBA code within.
See the tips & resources at the links below to help get you started with automatizing Excel (and other Office applications) using VBA code.
More information:
Office.com : Assign a macro to a Form or a Control button
MSDN : Getting Started with VBA in Office
MSDN : Recording a Macro to Generate VBA Code)
MSDN : Revising Recorded VBA Macros
homeandlearn.org : Excel VBA For Complete Beginners
Stack Overflow : Overview of Form Controls and ActiveX Controls
Original Post:
How to filter a chart
The ability to filter a chart by month is built-in to Excel. After you create a chart, you can change the data series in two ways:
Use chart filters to show or hide data in your chart, or,
Use the Select Data Source dialog box to edit the data in your series or rearrange them on your chart.
Filter data in your chart
Click anywhere in your chart.
Click the Chart Filters button next to the chart.
On the Values tab, check or uncheck the series or categories you want to show or hide.
Click Apply.
If you want to edit or rearrange the data in your series, click Select Data, and then follow steps 2-4 in the next section.
Once you know how to use the filters, you can record a macro while filtering as required, an use the code for buttons or other controls.
More Information:
Office.com : Change the data series in a chart
MSDN : Recording a Macro to Generate Code
MSDN : Revising Recorded Visual Basic Macros

Steps
This is broadly similar to yours. Below is just meant to show you how to use dynamic named ranges as chart series sources. If you later decide to specify start and end ranges of months, you could use this same model and have the start and end indexes generate the height argument for Offset thus being able to plot ranges (though they would be aggregate).
Using the same data layout as in your answer.
① Add a forms control spin button, assign its linked cell as K3, then put the font to white so it is not visible. Its values run from 1-12 with increment 1.
② I then create two dynamic ranges:
LATE with formula =OFFSET(Sheet1!$G$4,Sheet1!$K$3-1,0,1,1)
OnTime with formula =OFFSET(Sheet1!$H$4,Sheet1!$K$3-1,0,1,1)
You can add these via name manager (Alt+F3)
Name manager:
③ I then insert a bar chart and add two series which use these dynamic named ranges as their source:
The above is for Late and this is repeated for OnTime. Note that the workbook name goes before the reference to the dynamic range.
④ In J2 I enter the chart title text "Monthly - 5 KPI Delivery" and point the chart title at this with = J2 in formula bar whilst chart title is selected on the chart.
⑤ K2 has the formula =INDEX(F4:F15,K3) and is used to retrieve the Month name from the list of months via Index with row argument the linked cell value from the spin button.
I then edit the chart X axis source with formula =Sheet1!$K$2 so the month name appears on the bottom of the chart.
⑥ Finally, any other chart sprucing you like. I chose to group and lock the chart and spin button together so they will move as a unit and to ensure data point values where shown.
Final result:
In action:

Related

Excel VBA Data Validation Dropdown, current highlighted item

Short question:
Is there any way to tell which item is highlighted in a Data Validation cell drop down?
Details:
I'm trying to make a tooltip (using a form that follows the mouse when that cell is moused over; will have to change this to cover the dropdown area as well) that gives more information based on the current selection.
I want to do this for the current highlighted item in the list, so that the user can get more info without having to select the item then start over if it's not the one they want.
I also am trying to avoid using the Form Controls & ActiveX Controls. That's more by request from the person in charge than my decision.

Insert Table header Row when column value changes

I have a table of overdue customer invoices. Each customer could have several overdue invoices and I want to collate these into separate customer tables, with a sum total of due amount.
I want this to be in one worksheet, with the header row above each customer table.
Therefore, I'm looking for a VBA macro that will go through the data in column A and when it sees a change, from one customer number to the next, it totals up the values for that customer and inserts the header row, ready for the next customer. And continues on...
Example sheet Here
Sheet(tab)1 shows raw data, sheet2 shows how the formatted data should look.
I'm stumped sorry and any help or direction appreciated. Hope the info is clear.
To get started I suggest you search google "creating vba macros read and write column"
Are you familiar with VBA macro? If not, you could use a combination of index, and match formula.
Otherwise VBA solution logic, in VBA editor - which is accessible by Alt +F11:
Click on the sheet you want your VBA code to apply to and start writing your function. For example a function to check a cell range called "myFunction" would be as follows,
A single example:
Sub myFunction ()
If range.("A1").value = "Customer1" then
Range("B1:E1").Insert([Shift], [CopyOrigin])
end If
Sub End
More work required to check condition on event, dynamic insert, and will need to be wrapped in a loop. The below are tutorials specific to the job you need to program your macro for.
VBA copy and paste code if condition is met tutorial here : https://youtu.be/qGZQIl9JJk4
VBA insert tutorial here : https://powerspreadsheets.com/excel-vba-insert-row/#Excel-VBA-Constructs-to-Insert-Rows
VBA How to SUM Totals At Bottom of a Column Dynamically : https://youtu.be/_0Vcnb3xdOM
The first question is-- What VBA have you tried?
Next, change col A heading to Customer, and col E heading to Amount
because these are the desired output headings .
Next, did you know that by dropping down View, and then Macros,
that there is a RECORD button? Click it.
Finally, it records your pressing Insert / PivotTable on a New sheet.
Drag the Amount field down to the Values box
After you drag each of the other fields to the Rows box,
left click on it in the Rows box, and select FieldSettings --
Subtotals tab -- Automatic for Customer, None for the others
Layout tab -- Show item labels in tabular form for each field
and just for Customer field--Insert page break after each item
At the end, click on any cell of the pivot, select PivotTableOptions --
Totals&Filters tab -- unclick Column totals
Click PageLayout,
then Margins -- make them narrow
then Sheet -- Rows to print at the top
Maybe Header -- Custom Header
Finally click on View / Macro
StopRecording
Presto, now the VBA has been captured.
Ok, so all you have to do is insert a Subtotal. Check out these screen shots.
Before:
After:
Depending on which version of Excel you are using, would probably determine how to navigate to the Subtotal button. Google for that, if you can't fine it. Should be super-simple.

Excel Shortout key to format axis bound?

I’m required to adjust chart axis to show 97 to 100 range as shown in image using send hotkey.
I’ve done(from chart) ctrl 1, ctrl up x3, ctrl 5 to get this far. I need the shortcut key to get to min/max.
(Do refer to screenshot)
enter image description here
Any help is appreciated!
#Yuca is right - there is no built-in hotkey. Instead, you will want to record a macro using this link to get you started.
When you record a macro, it translates the clicks and actions you perform into VBA code. The biggest challenge you will have here is getting VBA code that will be general enough to apply to any chart, but specific enough to format it properly. It can be done, but you may need to record 2 or 3 versions of the macro to get it right.
Another option is to simply use your chart as a template. Read up here for how to save your chart as a template. After it has been saved, you'll be able to add all of your next data sets to a pre-formatted template!

Excel: Return the last entries from a list of entries

Please excuse me for the wording of the title. Not sure exactly how to word this so it's probably best to just show.
I have a list that looks like this
Name Date Updated
==== ===========
Item 1 1/1/2015
Item 2 1/2/2015
Item 3 1/3/2015
Item 2 1/4/2015
Item 3 1/5/2015
Item 1 1/6/2015
This will be an ongoing list. As items are updated they will be entered in like this. I would like to create a second sheet that gives me the last date that each item was updated. So the result based on the above table would look like this.
Name Date Updated
==== ===========
Item 1 1/6/2015
Item 2 1/4/2015
Item 3 1/5/2015
I have found a few solutions on the web that work when I first input the formula (Links below), BUT when I add more entries in the first table the results wont update or they'll show the wrong data.
Links:
http://blog.contextures.com/archives/2014/02/04/find-last-item-in-group-with-index-match/
http://www.get-digital-help.com/2014/02/07/find-last-matching-value-in-an-unsorted-list/
Thanks in advance for any help.
You can simply omit the numbers in the formula to get the whole column:
=INDEX($C:$C,MAX(($E$3=$B:$B)*MATCH(ROW($B:$B),ROW($B:$B))))
(following the formula from your second link).
You can record a macro as you do it manually one time. Then assign that macro to a button. Then click the button anytime you need the sheet updated.
Steps:
Start on a sheet other than the one with the data. Explanation in #3 below.
Start recording your macro by going to View > Macros > Record Macro. In the bottom left you'll now see a square stop button for when you want to stop recording.
Select the sheet with the data. This way the macro will always remember to select the right sheet regardless of where you are.
Select the two-column range of cells that has your data, then continue selecting a few hundred rows down, or at least well beyond where you think your data will eventually go down to.
Copy
Select the sheet where you want to have the summarized data.
Paste
Sort by name (ascending) and date (descending) all at once (rather than two operations). Do this by going to the Data tab in the ribbon and selecting the white and blue sort button that has two A's and two Z's and says "Sort".
With this pasted and sorted range still selected, remove duplicates in the name column. To do this, do not change the selection. Go to the Data tab and select Remove Duplicates.
Now your items will appear once and the date will be the most recent date.
Click the "stop recording" square blue button in the bottom left to stop recording your Macro.
You can assign this macro to a button or to a shortcut. To add a button you need to show the developer tab and then draw the button using one of the options on the developer tab. I can't remember offhand how to show the developer tab. Once you have a button, right click and assign the macro to the button.
13A. If you want to customize the macro, click ALT+F11 to get to the visual basic editor. Double click on one of the things named something like "module" on the left and you can edit your the range in your macro, for example if your data suddenly goes down 100 more rows than what you planned and you want the macro to cover it. Save with CTRL+S. The next time you run your macro, it will reflect these changes.
13B. View > Macros to edit your macro if you want to assign a shortcut key to it instead of adding a button.
Try all this with a copy of your spreadsheet so that you don't delete data by accident.
Does it work for you?
You could easily do this with a Pivot Table. Drag Item to Rows area and Dates to the Values area. Then format the values as Date, and select to return Max.

Is it possible to override Excel 2007's right click functionality and replace it with a custom menu?

I'm working on a forecasting spreadsheet and I'd like it to make it as easy as possible for my forecasters to edit the forecast. I'm hoping to develop some custom VB that will allow the user to highlight a group of cells (in one particular row) and then right-click to display a menu that includes various methods of adjusting the highlighted cells:
increase by 10%
add 2 to each highlighted cell
spread an inputted value evenly to highlighted cells
and others
Questions:
How do I override Excel's right click functionality so that when my forecasters right click, they get the forecast adjuster menu form instead of Excel standard formatting menu.
Can anyone point me in the direction of a cell adjuster similar to what I am describing.
Thanks for you assistance.
I use this to edit my right click menu:
MenuRighter
Note: I did not write this, all credit to #Doug Glancy

Resources