Complicated Formula Issue adding specific values based on a parameter - excel

I have a table A and table B. Table A is the input table and table B is the output table. Table A has 2 Columns; Name and Quantity, and table B also has 2 Columns Name and Quantity, but the difference is that table B already has 48 names written inside it and the Quantity section is empty, And the whole of table A is empty. I'm not doing a very good job of explaining stuff. I know but if you are with me so far then.
Now I go to table 1 and put in the following data in the syntax [Name,Quantity] : {Sam,10},{Lilly,15},{Sam,25}. After putting in that data, I want the appropriate quantity cell in table B corresponding to the names to be equal to the total quantity each name has in table B.
In this case I want the output of table B show me {Sam,35},{Lilly,15} and the rest of the Names = 0.
I would prefer if this method stays in the terms of excel formula calculations and no macros or VBA as it will be easier for me to integrate this with the other functions of the spreadsheet I'm making. But I would not mind having alternatives.

If your data format is like this:
You could use either SUMIF or a Pivot Table
If you use SUMIF, then you could list all the names with zero's.
If you use a Pivot Table, a list of names will be generated automatically.
For SUMIF, if the Quantity column of Table B starts in B2, you could use a formula like:
=SUMIF(Table_A[Name],A2,Table_A[Quantity])
and fill down to last row.
If Table A is not a "real" table, just substitute the range references for the appropriate columns.
Results of the SUMIF method:
If you want to use a Pivot Table, then with the cursor in Table A, select Insert / Pivot table. Then drag Name to the Row Labels area, and Quantity to the Values area. Format to taste.

Related

Sum all new dynamic rows records excel sheet

I am looking for a formula to Sum all the rows in A column, the rows count is not known as user can enter runtime. Every formula on google is taking nth row range.
Since you have used table you can use the table name references in your formula. Every time the table size increase or decrease in row numbers, the formula will adjust to the new range, given the same header name is used.
So the formula for column A (entered in cell H10) would look like this:
=SUM(Table1[[#All];[Value]])
Table1: Is the name of your table. Click on your table and go to "Design" (see picture). At the very left you have the table name, in my case "Table1".
[#All]: Defines what you want to look at, in this case all values.
[Value]: Which column (header name of the specific column) you want to evaluate.
The formula for the other looks like (cell H11):
=SUM(Table1[[#All];[Mortgage]])
and (for cell H12):
=SUM(Table1[[#All];[Amount]])
There are function options with Table use that Option to add sum of that column then you'll get sum of column A when use that option!
Check this link: https://www.ablebits.com/office-addins-blog/2014/10/31/excel-sum-column/ -- check "Convert your data into Excel table to get total for your column" in this article.
it has detailed information how to do various operation with sum!

Restructuring data in excel

I am trying to condense data in a specific way. I want any occurrences of the number 1 in each column to show up as 1 (regardless of how many times it occurs) with the corresponding site, in the corresponding column. Some sites occur multiple times in the original data, and I want to make it so that only one of each unique site shows up in the resulting data table with a 1 for the corresponding column if there any 1's in the column from the original data.
I would think it would be a vlookup function, but I have tried many different things and I am really stuck on this.
Image of original data and what I am trying to do:
Thank you
This assumes that your data set only contains 1 or blank and this approach uses a Pivot Table with MAX function. Below are details in case anyone doesn't know Pivot Tables.
Select a cell in your data and insert Pivot Table. Note, I added a title for column A, as you need that in the Pivot Table.
Click in the created Pivot Table and the PivotTable Fields dialog should pop up. If not, right click in Pivot Table and select Show Field List.
Drag the Field names (Code, a, b,& c) down to the appropriate blocks below. (Values under Columns will be created for you.)
Click on the drop down arrow next to each field name and select Max. That will rename it to "Max of ...". If that bothers you, then you can type the name you want into the Custom Name field. Note, it will not let you type the same name as the field name, eg a, but it will work if you put a space in front of it.
Given that the Pivot Table would be a lot of work for a large number of columns, here is a formula based approach. Put this formula in cell G2, then drag it down and across to fill your new table.
Note, you will have to populate all codes that you have in column F. And if any new codes are added later you will have to keep this updated. One of the advantages of a Pivot Table is that it will do this for you.
I know that you won't be putting this in these cells, so adjust accordingly. In fact, I would recommend this be in another sheet.
=IF(COUNTIFS($A:$A,$F2,B:B,1)>0,1,0)
COUNTIFS($A:$A,$F2,B:B,1)
This will count each occurrence when the value in column A matches your code $F2 AND the value in column B equals 1.
If that count is >0, then you know that at least one match was found and the IF will return 1, otherwise 0.

Formula To Find Total For Individual Items Excel

I am trying to create a simple program in which I have 2 tables. Table A lists all the relevant items. Table B is for placing Client requests. As you can see, the Requested Items column on Table B contains a drop-down list with all the predefined items in Table A. There is also a column stating the quantity request for each item.
I am thus trying to create some sort of dynamic formula, which will be able to find all occurrences of a particular item in Table B, whilst calculating the sum of the Quantity for each of these occurrences, and put that value in the "Quantity Requested column in Table A. A simulation with manually-input data can be seen below:
Thanks in advance for your responses.
Use this structured formula at the column Qty Requested of TabelA (in any cell).
=SUMIFS(TableB[Qty],TableB[Requested Item], [#Item])
This structured format exploits very well the tables; it automatically fills the column and it will adjust whenever any of the two tables grows, shrinks, changes location, etc...
Use Sumif in C8 write:
=SUMIF(G:G,B8,H:H)
G:G is the column of Requested Item in Table B
H:H is the column of Qty in Table B
B8 is the Item in Table A
You can drag the formula down

Excel/PivotTable: Is there any way to prevent the cells from moving when I filter information?

My current pivot table contains 4 columns: time in Column A, then Zone 1 in Column B, Zone 2 in Column C, and Zone 3 in Column D.
Is there any way to "lock" the columns, e.g. if I apply filter by Zone and only select Zone 3, Zone 3 will stay in Column D?
Currently, if I filter by Zone and only select Zone 3, Zone 1 and Zone 2's column disappear and Zone 3 will then be in Column B.
Thanks for any help you can provide.
I'm going to say "No". Pivot tables are a world to themselves inside of Excel.
You may have noticed that if you do something that expands them into surrounding data, they don't shift that data, they just warn you. Similarly, if you have formulas that refer to certain columns in a pivot table, filtering the pivot table as you've done doesn't adjust the cell reference as it does when you add or delete regular columns. I assume this is the type of issue you're seeing.
If so, consider using the GetPivotData function, which allows you to refer to pivot table columns.
Below I've shown how this could work with a simple table. The GetPivotData formula uses a variable (an added bonus!) in cell F1. In this case it gives you the overall total for fiona:
=GETPIVOTDATA("value",$E$4,"name",F1)
Note that when I filter to just "fiona" it still works:
Note that you can make the formula as specific as the data in the pivot table. Here I get the sales for doug on Thursday. (I could use variables for both "doug" and "Thursday" here as well:
=GETPIVOTDATA("value",$E$4,"day","Thursday","name","doug")
The easiest way to create a GetPivotData formula is to type "=" in a cell and then click in the pivot table cell you are interested in. You can then edit from there.
Here's a great Contextures GetPivotData tutorial.
Yes, here is how:
1-Go to the column values you want to prevent from collapsing.
E.g.: Field Settings menu
2-On Field Settings, select the 'Layout & Print' tab, then check the 'Show Items with No Data' checkbox.
E.g.: Show Items with No Data option
This should prevent, say, your column D data from moving to the spreadsheet column A data whenever the columns to the left of D do not have any value for the filter/slicer settings.

Trying add up values but have multiple entries

I am trying to look up the value in one column and pull the number from another column.
Of course, I could use the simple V-lookup or Match.
However, the first column of data has multiple entries that are the same. If I Vlookup it is just going to pull the first number in the second column.
I need to pull each number from the second column and somehow add them together. Despite the fact I have multiple entries.
If there is a way to consolidate the multiple entries in 1st column while also summing up the numbers in the 2nd, that would be great.
I would recommend a Pivot Table. To create one, select a cell in your data range (which needs to have column names in the first row. Choose Insert / Pivot Table from the Ribbon and select the New Worksheet option for the location.
In the Pivot Table list on the new worksheet, drag the name of the first column to the Row Labels box and the name of the second column to the Values box. The name in the Values box should turn to Sum of <2nd column name>.
The Pivot Table will now show a sorted list of the column 1 values and the summed values of column 2. In the example, you'll see that
Does SUMIF do what you are looking for?

Resources