Variable Reference for COUNTIF Criteria in Excel? - excel

I want to count dates within a matrix using COUNTIF with each cell using different reference cells for the criteria.
I would like the reference in the COUNTIF criteria to vary positionally for each cell in the range (similar to how conditional formatting works). It seems that COUNTIF does not work this way. The reference in the criteria is stationary and each cell determination uses that one reference.
I could perhaps use COUNTIFS and have a criteria set for each column, but in my real workbook I'm dealing with too many to make that a simple solution.
The linked image shows an example of the kind of workbook I'm using and the formula in its current state. The red filled cells are expired trainings based on the renewal time.
Any and all help is appreciated, thank you.
=COUNTIF(B6:E6,"<"&TODAY()-(365*$B2))

Use SUMPRODUCT:
=SUMPRODUCT(--(B3:E3<(TODAY()-($B$2:$E$2*365))))

Related

Excel Dynamic Countifs range

Can a countifs range be dynamic?
I'm simply trying to do a countifs formula in a worksheet that is likely to grow, currently I have the upper bound set to 10000 but since I'm trying to count the number of instances a date appears in a list I have to have a countif formula for every single day of the year. Thats 365 countif formulas all with an upper bound of 10000 and I'm sure at some point in a few months I will have to update it.
Am I able to use Excel formulas much like I could in VBA to declare a dynamic range for my countifs function?
If you convert your cell range to a table (select your table then Insert > Table) you can refer to the entire column or row with your formula and it will adapt dynamically.

Need sumproduct excel formula with dynamic field

Requirement :
->green color cell need sumproduct of cells where 90% found in 1st Column with its activity wtg.
->pink color cell need sumproduct of cells where 95% found in 2nd Column with its activity wtg.
->blue cell need sumproduct of cells where 100% found in 3rd Column with its activity wtg.
Just an extract pasted here, need a dynamic formula to use it in a large data table.
Thanks in advance.
You can use SUMPRODUCT() like below formula then drag across as you need.
=SUMPRODUCT(($A$3:$A$7)*(B3:B7=B1))
You can also use SUMIFS() like
=SUMIFS($A$3:$A$7,B3:B7,B1)

How to make an Arrayformula calculation similar to Excel's table auto fill in Google Spreadsheet?

With Excel's Table, we can make SUMPRODUCT or INDEX formulas adjusting their reference cell automatically according to their rows.
https://drive.google.com/file/d/1wmKvI-XDt3kGmnMKkQe8hdlLjkJp5fDC/view?usp=sharing
In the example sheet, I can fill UNIT PRICE automatically with a formula =INDEX($I$2:$I10,MATCH(1,($H$2:$H10=B2)*($J$2:$J10<=A2)*($K$2:$K10>=A2),0))[UNIT PRICE(1)] or a formula =SUMPRODUCT(($H$2:$H$10=[#[Part No]])*($J$2:$J$10<=[#[Date-In]])*($K$2:$K$10>=[#[Date-In]])*($I$2:$I$10))[UNIT PRICE(2)]
I'd like to convert this to Google Spreadsheet but couldn't find a way to generate unit price formula automatically when a new data being input to the left part without filling all range with formulas before.
I know it's hard to use INDEX or SUMPRODUCT function with ARRAYFORMULA. It's not also possible to use a combination of range skill such as (H2:H10)&(K2:K10) since it searches a date range not a exact date.
Your help will be really appreciated. Thank you.

Using SUMIF function and the range and [sum_range] change with every cell

I have looked for this answer but haven't found anything that has worked so I apologize if this is a duplicate question.
I am using Excel 2010 and have two sheets within one workbook. The first sheet holds the majority of information regarding individual members and is where I am using the formula. The second sheet holds data regarding each members' usage. Each line represents one individual. I am trying to gather all of the instances for one individual listed in sheet two and place it in a cell in sheet one.
I have used the sumif function which works perfectly for the first individual I use it on. After that, dragging the box changes both the range and sum_range of the formula along with the criteria. I want the criteria to change to the cell in the next row but I need the range and the sum_range to remain the same for every cell. If I copy the formula from the first cell and paste it into the second row, nothing changes.
Any ideas as to how I can make the sumif formula work over the entire column without changing the range and sum_range? Or is there an easier way to do this? Please keep in mind, the second sheet will expand over time to include more and more instances which will need to be included in future calculations.
Lets say your range is A1:A3 so to completely lock it just change it into $A$1:$A$3.

How to use sumifs formula with horizontal table (and data range)

I have an excel sheet which I need help with.
I have already took sum with
=SUM(INDEX(B3:K7,MATCH(A13,A3:A7,0),0))
formula and need to get the sum for specific data range. Like sum only for last 3 days from today.
Please help.
Try this SUMPRODUCT variant
=SUMPRODUCT(INDIRECT("B"&MATCH(A13,A3:A7)+2&":K"&MATCH(A13,A3:A7)+2),--(B2:K2>=(B10-3)),--(B2:K2<="B10"))
UPDATED
To have the formula in different sheet you need to include the sheet references. I suggested cutting and pasting it from Sheet2 to Sheet1 but missed out that the part inside INDIRECT will not be adjusted by Excel automatically.
=SUMPRODUCT(INDIRECT("Sheet2!B"&MATCH(A13,Sheet2!A3:A7)+2&":ZZ"&MATCH(A13,Sheet2!A3:A7)+2),--(Sheet2!B2:ZZ2>=(TODAY()-7)))

Resources