Summarize Amount with 2 matching data - excel

i have a excel table like the following:
Amount
Debit
Credit
500
153100
279000
100
153100
251100
150
153100
279000
20
155100
279000
At the end i need a sum of this table like:
650 - 153100 to 279000
100 - 153100 to 251100
20 - 155100 to 279000
For every Debit i want the sum the matching Credit columns. (In this example 500 + 150 are sumarized because both come from 153100 and go to 279000)
Can i do this in excel (without VBA)?

You could use a pivot table to get the result you need (without going into the construction of the pivot table) ...
https://support.microsoft.com/en-us/office/create-a-pivottable-to-analyze-worksheet-data-a9a84538-bfe9-40a9-a8e9-f99134456576
Specific options on your pivot table need to be ...
Right click on each field and go to Field Settings..., go to the Layout & Print tab and check the box labelled Repeat item labels
Select a cell within the pivot table and go to the Design tab in the ribbon and select Report Layout -> Show in Tabular Form
You'll also want to turn off your subtotalling for the Debit and Credit columns by right clicking and unselecting the subtotal option directly within the context menu.
Just make sure you drop in the rows/columns/value like shown in my screenshot.
If you have Excel 365, you can use a combination of the UNIQUE function with SUMIFS ...
Cell E1 = =UNIQUE(B1:C5)
Cell G2 = =SUMIFS(A:A,B:B,E2,C:C,F2) (Fill Down and I've been lazy on the bounds of the lookup, I just selected the entire column because it was easier to demonstrate)
There's always someone smarter than me out there that will likely come up with a better solution but either of those options should work for you.

Related

EXCEL How to concat values from multiple rows in a single row on another worksheet?

I have two columns:
ID country
1 spain
1 france
1 sweeden
2 mexico
how to concat all the countries with ID 1 and send them to another column like this
ID2 country2
1 spainfrancesweeden
How to do this with an excel formula instead of a VBA code.
I tried this:
=CONCATENATE(VLOOKUP(A18; Hoja2!A19:Hoja2!B24; 2; 1); " ";VLOOKUP(A18; Hoja2!A19:Hoja2!B24; 2; 0))
But it only gets two results (but there are 3)
Layout of sheet:
Do convert your data to table and insert pivot table, on the screen of create pivot table check the option add this data to the data model, now go to pivot table fields and right click on the table name and click on add measure. There would be a window opened in the name of Measure in which you put the measure name and value description as per your choice. Now come to formula area which would start with = sign there you type below formula concatenatex(table1,table1[country],","). Now one additional function would had created in the area of pivot table fields. Now you can drag id into rows and drag the created function into Values. It would show the desired result as follows.,
Row Lables|Joincountry
1 |Spain,France,Sweedan
2 |Mexico
Hope this is order and would help you.
!
[result]1

How to find the value of column name and row name when a value at the intersection is matching a condition

How to find the value of column name and row name when a value at the intersection is matching a condition
I have this data
TC1 TC2 TC3
TC1 100 87 95
TC2 88 100 99
I need to return the combinations where value is greater then 95 like:
TC1,TC1 TC1,TC3 TC2,TC2 TC2,TC3 and so on.
Can anyone help here?
This is for Excel 2016.
So, you've got your data:
Highlight it, and then click 'Format as Table' from the Styles Group in the Home ribbon. (yes, your table has headers)
With this table in focus, navigate to the 'Data' ribbon, and click 'From Table/Range' in the 'Get & Transform Data' group. This will open the query editor. If you're not used to it, don't worry. Although it can get quite complex in here, we're going to be pretty straightforward.
Highlight columns TC1, TC2, TC3 (Hold down [control] and click each column header). Go to the Transform ribbon, and click on 'Unpivot Columns' in the 'Any Column' group. Look at what happens, it's awesome.
Now, click the arrow next to the Value column. Go to 'Number filters' on the drop down. Pick, 'greater than equal to.' A 'Filter Rows' dialog opens. next to 'is greater than or equal to' put in 95.
Click OK. Your data set is filtered. Yes! Go back to the home tab, click 'Close & Load'
Admire your gorgeous list of tuples for values greater than 95.
Good luck! Hope it helps.

Applying Multiple Value Filters in Excel Pivot

Using Excel 2013, I would like to apply a Top 10 Filter to a pivot and also apply a filter to an additional values field. Is this possible?
I would like to filter off all 1's from Sum of Individual Claims Column, but still have the top 10 by average of % of claims (minus the claim volumes that were only 1).
Table 1 with 1's in Sum of Individual Claims Column
The resulting table should look like this.
I found a workaround to use multiple filters in a pivot table, by using a helper column in the source data. Here is a step by step approach you can adjust for your needs.
Step 1: Add Helper Columns to the data source with a new heading and any constant value in every row. (You need one helper column per extra filter. If you want to use 2 filters, you need one helper column)
Step 2: Add the Helpercolumn attributes to your row-fields of the pivot table.
Step 3: Choose the tabular layout where all row attributes are in one row.
Step 4: Now you can apply different filters, one for each attribute in the row-field. In your case: the top 10 filter for the "Heading 1" and an unequal filter to "Help 1". This will yield the same result as if you use multiple filters for the "Heading 1".
Step 5: If you now apply this to VBA, the code could look like this:
Dim pvt As PivotTable
Set pvt = ActiveSheet.PivotTables("PivotTable1")
ActiveSheet.PivotTables("PivotTable1").AllowMultipleFilters = True
With pvt.PivotFields("Heading 1")
.ClearAllFilters
.PivotFilters. _
Add2 Type:=xlTopCount, DataField:=ActiveSheet.PivotTables("PivotTable1"). _
PivotFields("Average of Heading 2"), Value1:=10
End With
With pvt.PivotFields("Help 1")
.ClearAllFilters
.PivotFilters.Add2 _
Type:=xlValueDoesNotEqual, DataField:=ActiveSheet.PivotTables("PivotTable1" _
).PivotFields("Sum of Heading 3"), Value1:=1
End With
If you need to apply multiple value filters to the same field in a pivot table, the easiest way to do that is as follows:
Add a column with identical values to the Source Data and add an index to its name. E.g. I had Hospital column and created its clone named Hospital 2
Change the Source Data to make sure the new column is included.
Refresh your pivot.
Put the new column clone (i.e. Hospital 2 in our case) into ROWS window of the PivotTable Fields tab.
Make sure that all fields in Columns window in PivotTable Fields tab have the following settings:enter image description here
Now you can apply 2 different value filters to the old and new identical columns!!!
If you don't need to see the newly added clone column, just hide it.
That's it!!!
Add Individuals Claims to the Filters pane in the Pivot Fields Area.
A filter will appear in your above your Pivot table. Add unselect the value 1.
Now go to the Row Labels dropdown button and select Value Filters, then Top N...:
In the highlighted in red option select your Average of % of Claims measure.

How to create chart in MS Excel for unique key sequence?

I have a data something like below,
data set #1
A 1
B 2
C 3
A 10
B 20
C 30
A 50
B 60
C 70
It is not properly row-column formatted, so the generated chart is not as expected.
I know it will be easier if it is formatted like below.
data set #2
A 1 10 50
B 2 20 60
C 3 30 70
But how to generate a line chart for my data set #1 that should look similar to data set #2's chart?
[I have a huge set of data, it can't be transformed by hand]
here I explain how to make a pivot chart of your data, as suggested by #Riverside
lets label your data: put "label" in cell A2, "value" in cell B2
in your table, go to cell C3 and type the following formula: =COUNTIF($A$3:A3,A3)
drag the bottom right corner to auto-fill the rest of the rows. Lets call this column:"order" (put in cell C2)
now select cells A2:C11 and click on: insert -> pivot table -> pivot chart. Under "Choose where you want the PivotTable.." select the radio button which says: "Existing worksheet" and put E2 in the box. click ok.
in the pivot table Field list pannel on the right drag the "label" field from the top panel into "legend fields", "order" into "axis fields" and "value" into "values".
on the top left of the ribbon, click "change chart type" and select "line"
you can close the pivot table dialog boxes and style your chart as normal.
if you wish to hide the pivot table data, you can simply hide the columns it is in (select columns , right click, hide)
The data would have to be transformed to get a chart like data-set #2. For transformation you could either use pivot tables like #Riverside mentioned, or you could use some simple formulas. Check out this excel which does what you are trying to do.
All you have to do is paste your data, however large it may be, in the first two columns (A and B), and the data is instantly transformed into the 2D set. I've already defined a chart, so you only have to redefine the chart ranges by dragging.
In case the link for the file doesn't work, use this link (Dropbox). Note that if you view it on dropbox itself, some formulae don't work, so I'd suggest downloading and viewing.
Put two labels on top of your data.
Then select all data, select insert Line chart in your excel.
Excel automatic see your labels as labels and the rest as data. Your line chart should be fine now.

PivotTable's Report Filter using "greater than"

I have a pivot table which has one of the fields (Probability) in a Report Filter. Its values are percentages in step of 5 (0,5,10,15,...,100). I'd like to use it to filter probabilities greater than or equal a certain value, but the filter only filters exact choices.
For now I use a workaround of allowing multiple values, and then selecting all values from the threshold I want, all the way to 100
This solution, apart from being awkward, doesn't show my selection, which is necessary as this table is being printed out.The Filter's display value is "(Multiple Values)" and I'd like to show all the values selected, or even better, something like ">=20%". I don't really care if they show in the field itself or in another cell outside the Pivot table.
My questions:
1) can I get the filter to filter on >= of my seletion? If not
2) Can I show the multiple selections like ">=20%"
I know this is a bit late, but if this helps anybody, I think you could add a column to your data that calculates if the probability is ">='PivotSheet'$D$2" (reference a cell on the pivot table sheet).
Then, add that column to your pivot table and use the new column as a true/false filter.
You can then change the value stored in the referenced cell to update your probability threshold.
If I understood your question right, this may get you what you wanted. The filter value would be displayed on the sheet with the pivot and can be changed to suit any quick changes to your probability threshold. The T/F Filter can be labeled "Above/At Probability Threshold" or something like that.
I've used this to do something similar. It was handy to have the cell reference on the Pivot table sheet so I could update the value and refresh the pivot to quickly modify the results. The people I did that for couldn't make up their minds on what that threshold should be.
In an Excel pivot table, you are correct that a filter only allows values that are explicitly selected. If the filter field is placed on the pivot table rows or columns, however, you get a much wider set of Label Filter conditions, including Greater Than. If you did that in your case, then the added benefit would be that the various probability levels that match your condition are shown in the body of the table.
One way to do this is to pull your field into the rows section of the pivot table from the Filter section. Then group the values that you want to keep into a group, using the group option on the menu. After that is completed, drag your field back into the Filters section. The grouping will remain and you can check or uncheck one box to remove lots of values.
After some research I finally got a VBA code to show the filter value in another cell:
Dim bRepresentAsRange As Boolean, bRangeBroken As Boolean
Dim sSelection As String
Dim tbl As Variant
bRepresentAsRange = False
bRangeBroker = False
With Worksheets("Forecast").PivotTables("ForecastbyDivision")
ReDim tbl(.PageFields("Probability").PivotItems.Count)
For Each fld In .PivotFields("Probability").PivotItems
If fld.Visible Then
tbl(n) = fld.Name
sSelection = sSelection & fld.Name & ","
n = n + 1
bRepresentAsRange = True
Else
If bRepresentAsRange Then
bRepresentAsRange = False
bRangeBroken = True
End If
End If
Next fld
If Not bRangeBroken Then
Worksheets("Forecast").Range("ProbSelection") = " >= " & tbl(0)
Else
Worksheets("Forecast").Range("ProbSelection") = Left(sSelection, Len(sSelection) - 1)
End If
End With
Maybe in your data source add a column which does a sumif over all rows.
Not sure what your data looks like but something like =(sumif([column holding pivot row heads),[current row head value in row], probability column)>.2).
This will give you a True when the pivot table will show >20%.
Then add a filter on your pivot table on this column for TRUE values
I can't say how much this might help you, but just found a solution to something similar problem which I faced.
In the Pivot-
Right click and choose Pivot table options
Choose the display option
uncheck the first 'Show expand/Collapse buttons'
check the 'Classic PivotTable Layout(enables dragging of fields in the grid)
click ok.
This would refine the data. Then, I had just copy and pasted this data in a new tab wherein I had applied the filters to my Total column with values greater than certain percentage.
This did work in my case and hope it helps you too.
Use a value filter. Click the dropdown arrow next to your Row Labels and you'll see a choice between Sort A to Z, Label Filters, and Value Filters. Selecting a Greater Than value filter will let you choose which column to use to filter out rows, even if that column has no dropdown arrow itself.

Resources