Specifying range criteria without the use of a structured table - excel

I am working on a table that holds the total amount for products sold or bought in the total column with a reference column that refers to the product id which the total points to.
I need to mark of those products for which the total amount (debit/received) calculates to 0 for each product reference.
For this, I am currently using structured table references to specify the range in my SUMIFS formula like this
=ROUND(SUMIFS([Total],[Reference],[#Reference]),2)=0
Could you please help with how to do the same using the range instead of table references as in
=ROUND(SUMIFS(AD:AD,AC:AC, ..............),2)=0
Please help me on how to write the formula in this case.

You need to enter this at a given row, say row 2:
=ROUND(SUMIFS(AD:AD,AC:AC,AC2),2)=0
' ^^^ The row you type in
and then copy/paste in the cells below; the row number will automatically adjust for each row.

Related

Sum specific values in the Grand Total row of a Pivot Table

Many thanks for your help in advance. I need help finding a way to sum specific values in the Grand Total row of a Pivot Table based on the corresponding column label. The challenge is that the row that the Grand Total is in isn't fixed, meaning in one instance the Grand Total may be in row 9, then after data addition/removal, it will be in a different row. Also, multiple columns match the criteria.
The attached image show what the Pivot Table looks like. I2 and J2 show the output I need regardless of which row the Grand Totals are in.
Credit to #DavidLead for pointing me in the right direction. The three screenshots attached to this answer are a supplement to the guide for using the GETPIVOTDATA formula in excel. I am using Excel 365.
In the first screenshot, you will see the raw data reformatted to have our columns, i.e. Name, B, A, and Month. Cell N2 shows the total/sum for A. in January and the formula is shown in the second screen capture, Cell O2 shows the sum/total for A. for all months combined. The formula is also shown in the second screenshot.
Regardless, you will see in the formulas for N2 and O2 that I reference the cell $G$1. This tells the formula which pivot table to look for the "A.". Then in the third position of the formula, I reference the Pivot field list column name "Month", and in the third position, I specify "January".
The formula can return 1 to 126 pairs of field names and item names that describe the data that you want to retrieve. In my case, I could have retrieved the total for John in January or for all months.
For example,
Total for John in January
=GETPIVOTDATA("A.",$G$1,"Month","January", "Names","John")
Total for John, January thru March
=GETPIVOTDATA("A.",$G$1,"Month","January", "Names","John")+GETPIVOTDATA("A.",$G$1,"Month","February", "Names","John")+GETPIVOTDATA("A.",$G$1,"Month","March", "Names","John")
The benefit of this formula is that if the Grand Total row changes I will always get the sum of A. and/or B. for all months. It is dynamic and is what I needed to accomplish.
Formula Explanation
`=GETPIVOTDATA("A.",$G$1,"Month","January")`
"A." = the column that has the data I need
$G$1 = the reference to the Pivot Table (Microsoft's
knowledge article states this can a reference to any cell, range of
cells, or named range of cells in a PivotTable. This information is
used to determine which PivotTable contains the data that you want to
retrieve.)
"Month" = the column I need
"January" = the name of the row for the total I need
To get the total for "A." from January thru March, I use the following formula:
=GETPIVOTDATA("A.",$G$1,"Month","January")+GETPIVOTDATA("A.",$G$1,"Month","February")+GETPIVOTDATA("A.",$G$1,"Month","March")
The most important factor of this formula is that you reference a cell in your pivot table. In my case, I used $G$1. I also tried other cells in the pivot table as reference cells, and the formula returned the correct values.
I hope this helps the next person who needs a similar solution and finds this answer. Please give this a vote if it helped you.
1st Screenshot
2nd Screenshot
3rd Screenshot

Countifs for longer range

I am currently using Countifs to add up an amount of registrants that have a gender criteria and birth year criteria.
Formula:
=countifs(sheet1!N4:N90,”male”,sheet1!F4:F90,”1990”)
This works and shows me the amount of males born in 1990. I’m currently running this formula in sheet2. Every day or two I’ll import the registrations and the range will grow past row 90. Is there a way to write the formula that will adjust the result when I paste in new registrants?
Currently I can’t extend the formula past 90th row. And with all the birth years, it’s be great if I didn’t have to edit the formula manually every time I update the list.
There are at least 4 ways to do it:
Use "N:N" and "F:F" instead of "N4:N90" and "F4:F90". It will refers to the whole column.
Formula: =countifs(sheet1!N:N,”male”,sheet1!F:F,”1990”)
Use VBA (I'm not going to explain that now because I guess it's not what you want)
Use Dynamic Named Range like explained here https://www.excel-easy.com/examples/dynamic-named-range.html.
It applies to range without empty values (the height of the range is based on the number of values in the column and adding them to the row of the first row of your range (offset base).
We don't know how your registrant records on sheet1 look. I guess that on column A you have a record ID or something else that it's not empty until the table ends. While on column N and F you can have empty values (e.g. registrant year or gender is not mandatory).
So you have to create a named range 'Genders' that will refers to =OFFSET($N$1,0,0,COUNTA($A:$A),1) if you have not an header row. If you have one header row you have to start the offset from N2, etc. =OFFSET($N$2,0,0,COUNTA($A:$A),1).
You have to do the same thing for the birth year and use these named ranges in your formula, like:
Formula: =countifs(Genders,"male",BirthYears,"1990")
Convert the range of records to a table, selecting it and going to Insert-->Table. You'll be able to use table field names in the formula (Solution based on Ron Rosenfeld' comment)
=countifs(Table1[Gender],"male",Table1[BirthYear],"1990")

Counting unique values in Range which is Index by another Value

I have a list of urgency types which are sorted by building name and Community. Every building name has 5 urgency types and each community has a varying number of buildings in it. I am trying to return a count of how many buildings are associated to each community.
I have tried this formula
=SUMPRODUCT(1/COUNTIF(BuildingCostsTbl[Building Name - Click to go to Sheet],BuildingCostsTbl[Building Name - Click to go to Sheet]&""))
but it only returns the total number of buildings in the table and does not count by community. I have also tried using the MATCH function within this to narrow the range criteria for the COUNTIF function but i keep getting errors I do not understand.
Here is an snapshot from my excel worksheet of what I am looking to do.
Excel Snapshot
The MATCH formula I was trying to use to narrow the COUNTIF lookup range is
=MATCH(H9,BuildingCostsTbl[Community])
Here is a small example based on this handy source:
The formula with above sample data in D2:
=SUM(--(FREQUENCY(IF($A$2:$A$9=C2,MATCH($B$2:$B$9,$B$2:$B$9,0)),ROW($B$2:$B$9)-1)>0))
Note: It's an array formula and need to be confirmed through CtrlShiftEnter
You can adapt this to your needs when you use your table.
You can use a Pivot Table.
Given this data:
Insert Pivot Table and select add this data to the Data Model
Drag
Community to Rows
Building Name to Values
Costs to Values
Edit the Value Field Settings for Building Name:
Distinct Count
Change the column name
Edit the column name for the Costs column
Voila:

Trying to reference data in variable rows after matching specific cell in excel

In Excel I'm trying to paste in weekly time card reports and then reference the bottom line of each section which contains the yellow highlighted text string in column B (report contains 15-20 sections with variable row differences).
Without using VBA, is there a way to identify an employee ID (Column A), then calculate how many rows below that ID that the last text string cell is located in column B (Highlighted in yellow in the example). Then use that row difference to offset the INDEX formula to grab correct row from the table.
I was using INDEX/MATCH to find the employee ID and then trying to offset the row return per employee manually when I realized that the different job codes rendered that formula inaccurate.
I had used this to reference the proper columns with the offset for one of the weeks, but each week varies. The "+17" at the end of the below formula is where I need the variable row difference to grab the yellow highlighted cell.
=INDEX($A$1:$A$100,(MATCH(A61,$B1:$B$100,0)+17))
Thanks in advance, hopefully I provided the right info to answer the question if there is a solution!
after a revamp of the thought process, the following formula will return the information corresponding to as specific employee and their tax information which is stored in column B in a cell with "EFURTA" in it. No other cell in B within the employee block can contain "EFURTA". If that happens only the first occurence will be returned.
Assuming your data is layed out per the image below, the following formula will return the information you are looking for:
=INDEX(B:B,AGGREGATE(15,6,ROW($A$1:$A$80)/((FIND("ERFUTA",$B$1:$B$80)>0)*(ROW($A$1:$A$80)>MATCH(D2,$A$1:$A$80,0))),1))
Adjust the ranges to suit your data.
If you just want the row number, just grab the aggregate part of the formula and drop the index.

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!

Resources