How to add sort buttons to an excel spreadsheet? - excel

I have a spread sheet with 6 columns (A-F)
A- WO#
B- Priority
C- Equipment #
D- Description
E- Brief Description of Problem
F- Shutdown WO Y/N
I want to be able to install a button that will sort the data by priority and one to sort the data by WO#. What would be the macro that I would need to do this? There will be no more columns added but the amount of rows of data will always be changing. Ive tried to make my own but cant get it to work when I start to add more rows of data.
Any help is appreciated.
Thank You

Highlight the columns, go to Data tab, click Filter, then in the column drop-down menu, you can choose sort.

Are you trying to create your own sort button or simply trying to sort data in a specific order?
Here's instructions for the latter:
1.Select the cell range you want to sort.
2.Select the Data tab on the Ribbon, then click the Sort command.
3.The Sort dialog box will appear.
4.Decide the sorting order (either ascending or descending).
5.Once you're satisfied with your selection, click OK.
6.The cell range will be sorted by the selected column.

Related

How to use offset for dropdowns

If you have a large set of data how do you eliminate spaces when you have a dropdown in Excel if you have data on row 1 then nothing then data on row 30. etc?
You will need to go make another tab filter in the data validation data in that tab then you will need to create a dropdown in that tab then open up name manager and enter this formula in:
=OFFSET(Calc!$E$7,0,0,COUNTA(Calc!$E$7:$E$200),1)

How to filter out multiple values assigned to a specific name in my filer column?

I need to create an Excel template with f.e following columns and data:
Example of an Excel Table
and so on. So my goal is to set up the filter in such a way, that when I choose A1 from A column, I can get all the related B,C and D values, like B1,C1,D1; B1.1,C1.1,D1.1;B1.2,C1.2,D1.2
With the normal filter I can only see B1,C1,D1 when I choose A1.
The only solution I came up with, is writing A1 in every row that has relevant B 1.x ,C 1.x and D 1,x. Then I can see all relevant stuff, but this solution is not the most effective one(especially when values inserted will be a small text, writing same sentences in each row makes it look a bit messy)
The Pivot Table also does not recognize B1.1 C1.1,D1.1; B1.2 C1.2,D1.2 as related to A1. Even when I copied A1 in every row, it still couldn't sort it correctly.
Can you please help me with these quesitons? Many thanks in advance!
Kamola.
Update: I created a following example for clarification, hope it will help a bit! Unfortunately I cannot share the Excel Sheet per Stack Overflow, so here is a screenshot of it:Example of the content
MANUAL APPROACH
In your example which is a Table but not a pivot table,
Highlight Column Problems in your table;
Press Ctrl+G on your keyboard to bring out the Go To window;
Click Special... button at the left corner of the window;
Select Blanks then click OK;
Do not alter anything, go to the formula bar and enter =A2, then hold Ctrl key and press Enter.
If you have done the above steps correctly, you should have column A filled with Problem IDs.
POWER QUERY APPROACH
FYI, if you are using Excel 2010 Professional Plus or later versions of Excel, you can add your data table to Power Query Editor, right click the column header of the first column and select Fill -> Down to quickly fill the column with all Problem ID.
PIVOT TABLE APPROACH
If you want to show row labels in each line in a pivot table (as mentioned in your post), click somewhere within the pivot table, go to Design tab in the Excel ribbon, click Report Layout and select Repeat All Item Labels.
Let me know if you have any questions. Cheers :)

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 columns to multiple rows

I have a set of data that consists of a product SKU, and then the sizes as multiple columns. I need to transpose this data to list the sizes in one column (which I can do) but, each size needs to list the SKU as well which is something I can't seem to achieve with transpose. See images for an example.
Follow these steps...
1
Click on a cell to the right of your data.
On the keyboard press Alt and then while holding Alt down, press D and let go.
Now press P on the keyboard.
The ancient PivotTable Wizard should now be displayed.
2
Select Multiple Consolidation Ranges. Click on the Next button.
3
Select I will create the page fields. Click on the Next button.
4
For the Range field at the top of the dialog, select the range A1:J6. (This is your sample data.) Click on the FINISH button.
5
You will now see a PivotTable. You are going to double-click one particular cell... and this will create a new worksheet with your data transposed and normalized. That cell is the bottom-right cell of the PivotTable (at the intersection of Grand Total and Grand Total). Double-click it.
6
On the new sheet that is now displayed, delete column B and click on the little arrow in cell B1. Uncheck (Blanks) and click OK.
That's it. It seems like a lot, but it's not. It takes just a couple of seconds once you get used to it. And you can go ahead and delete the PivotTable now. And you can copy your normalized data out of the filtered rows and paste wherever you like... and then just delete that temporary sheet.

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.

Resources