Excel pivot table search filter with and / or - excel

I am trying to filter a field in a pivot table so that it only shows some values.
I have a field which is product code and I want to only show the product codes that are H01, P07, F04, L43, ... and the list continues. For the moment, I have to click the little arrow next to the field, do a search on the code and then click on the checkbox add current filter to selection and hit ok. I have to do this 20 times for the 20 different product codes.
Is there a way to enter in the search box immediately H01, P07, F04, L43, ... just once and then hit ok and I ll see all the product codes immediately?
Thanks,
John.

You can loop through pivot items and select the ones that match your criteria using VBA as suggested here:
Looping through report filters to change visibility doesn't work
The only issue I've had with this sort of approach is that you cannot deselect the only selected item, so if you are going to be deselecting then you should make sure to select particular items as well.

Related

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.

Check for duplicate value among 10 combox boxes when summit excel vba

I have 10 comboboxes on my userform that share 10 same selections, and I would like to check for duplicated value before summit.
As far as I can imagine, there are two ways to get the result, the first one is to check for same value among these ten boxes when summit by using message box OR to hide the selections from other comboboxes once the option is being selected by any one of the boxes.
Since I am new to vba, I am having a hard to grasp this idea in to code, please help.Userform with 10 comboboxes that share the same selections
I think your second idea is the best, because it prevents the unwanted behavior instead of correcting it.
You can either build a responsive sql which filters out the already selected values, or you could create 10 queries, one for each combobox.
Start by creating a table with values you want to have for your selection.
Make a query like this: (Combobox1) SELECT value FROM Table;
This is the input query for your first combobox.
Create a second query (Combobox2) based on the first query. SELECT value FROM Query1 WHERE value <> Forms!formname!Combobox1
This will be the input query for your second combobox.
Now create a third query based on the second like: SELECT value FROM Query2 WHERE value <> Forms!formname!Combobox2; Which will be the input for your third combobox.
Keep on doing this untill you have a query for each combobox.

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.

Dynamic Filters in Excel

I'm using Office 2013, and working on a worksheet in Excel.
My question is, is there a way to create a dynamic filter in Excel?
To explain in more detail, I have a dynamic worksheet, where upon opening the user will get a few drop-down options. After the user has selected one option from each of the drop-downs, the worksheet will display a table of data based on the user's inputs. The user can change their selections from the drop-downs after the table has been displayed, and can also clear their selections. If they clear their selection, the table will disappear.
Now, the first column in the result Table will contain Text values, but can also contain blanks. These values or blanks are all decided based on the user's selections in the previously mentioned drop-downs, which are displayed permanently to the left of the table. I want to add a filter to this first column of the result table (and to the rest of the table with it) such that only the non blank cells are displayed in the table every time the drop-downs are changed.
As I understand your need correct, I can give you this solution:
For getting a better result make your range to Table.
Select Power View from Insert items;
A sheet Power View 1 will added to your workbook;
From right pane select Table1 and its fields;
From Filter pane select as you want for filtering.

Sharepoint re-order item order in the list

In the list, I set-up "ID" column and "Title" column.
I added 10 items in the list, and I'm trying to put the 10th item between 1 and 2.
After my research, many people said I can't manually change ID number...
Is there a way to re-order the item?
deleting every items is the only answer?
Please help!
The ID column is an internal identity-like column. You cannot change the value. If you need a column that you can order by (and change), just create a new column called SortOrder or something. Then sort by that column.
I know this is an old post, but I thought this might help someone who might be looking for an OOB answer.
Go into your links list so that you see your List Tools, Items and List at the top.
Select Items.
There is a Change Item Order Icon in the Ribbon. This will allow you to renumber the Links in your list and change the order.
You can manually change the items order if you create your list based on a link list definition. This kind of list allows you to re-order items as you require through a ribbon button. I use this workaround often.
The ID Column is SharePoint inbuilt and you can not change the value of it.
for your solution either you need to delete all item and insert it again or as #Nigel Whatling say you have to add SortColumn
Column Setting will only change the order in the SharePoint List. To change the view order Use the Modify View Selector to adjust the way the fields are sorted. Modify View is found on the ... next to Find and Item Box or If your in the site setting it is under View on the lower 3rd of the page
I also got stuck with this and couldn't use the previous answers as I couldn't see the buttons they spoke of in the ribbon.
I went to List > List Settings in the ribbon. At the bottom of the list settings page I click on a View to edit it (or create new view). Unser the heading Sort you can change the column you wish to sort by and change from descending to ascending etc.
Actually, if I understand the question, it was just what I was trying to accomplish and spent most of my morning working on.
Select the List.
From toolbar, select List under List Tools.
Click List Settings.
Below the listed columns, see Column Ordering
Modify "Position from Top" number and click OK at bottom.
Updated steps:
Select the List.
From toolbar, select List under List Tools.
Click List Settings.
Above the Column list click on the "Item" link
At the bottom of the page select "Column Ordering"
Modify "Position from Top" number and click OK at bottom.

Resources