COUNTIFS to ignore hidden rows excel 2007 - excel

would appreciate help with this one. Made more tricky because it concerns Time. I currently have
=COUNTIFS(Data!A:A,">="&TIME(0,0,0),Data!A:A,"<"&TIME(1,0,0))
but it doesn't work when I hide rows.
I've managed to work out a similar issue for other data which now uses
=SUMPRODUCT(SUBTOTAL(102,OFFSET(Data!$H$1,ROW(1:10000)-1,))*(Data!$H1:$H10000<35))
but I can't work out the syntax for my Time calculation.

You can just add the time criteria in to that second formula, e.g.
=SUMPRODUCT(SUBTOTAL(102,OFFSET(Data!$H$1,ROW(1:10000)-1,))*(Data!$A1:$A10000>=TIME(0,0,0))*(Data!$A1:$A10000<TIME(1,0,0)))
...but if you are using hour long "buckets" it might be easier to use HOUR function, but you can't apply HOUR to text values ,so if row 1 contains headers start at row 2
=SUMPRODUCT(SUBTOTAL(102,OFFSET(Data!$H$2,ROW(1:9999)-1,))*(HOUR(Data!$A2:$A10000)=0))

Related

Summing a Dynamic Range based on multiple criteria

(Pictures included) -
I'm trying to write a formula that sums the Forecast Qty (dynamic range) based on multiple criteria. The criteria I want to base it on is the Part number and the month (Aug-21, Sep-21 etc). Each part can have multiple forecasts for each month, I've ran a match formula that shows the first row in which each part changes, but am not sure how to necessarily break it down further into months.
The previous pictures will give more insight into what I want. The first picture shows my raw data and the Match function I performed to find the first row of corresponding part. The second picture shows where I'd like the end result. The '100' in the selected cell is the result of the formula I have ran below.
=IF(VLOOKUP(F2,HIghJump!B:F,4,FALSE)>DATEVALUE("9/01/2021"),SUM(HIghJump!F2:F6))
My issue is how do I get the range in the sum formula (F2:F6), to change based on corresponding month. Beyond that, how do I get this formula to change based on different parts and different numbers of forecasts per month.
Any help is greatly appreciated!
Use SUMIFS:
=SUMIFS(HIghJump!$F:$F,HIghJump!$B:$B,$F2,HIghJump!$E:$E,">="&EOMONTH(K$1,-1)+1,HIghJump!$E:$E,"<"&EOMONTH(K$1,0)+1)
This should go in L2 and copy down. Change the K$1 to each corresponding target date when moving over columns.
If I am understanding correctly and if you have the newest version of Excel, then FILTER will come in handy.
Try:
=SUM(FILTER(HIghJump!F:F,
(HIghJump!B:B=$F2)*(HIghJump!B:B>=K$1)*(HIghJump!B:B<EOMONTH(K$1,0)+1))
Note that it is generally considered best practice to use partial ranges (e.g. $B$1:$F$100 and $B$1:$B$100 instead of B:F and B:B), so that might be something you would want to consider if performance is of importance to you. Also make sure your sheet name is really "HIghJump" instead of "High Jump" or some variation.
Answer:
Had to create a column using MONTH(x), then base SUMIFS off that vs the original month column.
=SUMIFS(HIghJump!F:F,HIghJump!H:H,MONTH(K$1),HIghJump!B:B,F2)

reduce time when a different cell is blank

I am trying to build a program in Excel where if data is entered into a cell, the time will reduce in another cell.
I have 2 columns. One currently calculates slots based on blank cells. This is working fine using COUNTBLANK.
=COUNTBLANK('E1&3'!C3:C7)+COUNTBLANK('E1&3'!C16:C44)+COUNTBLANK('E1&3'!C50:C60)+COUNTBLANK('E1&3'!C68:C70)+COUNTBLANK('E1&3'!C76:C96)+COUNTBLANK('E1&3'!C101:C102)
I have another which calculates hours available and again this is working fine using =SUM.
=SUM('E1&3'!B3:C7)
What I want to do is combine these where if a cell becomes blank the time will increase, and if not blank it will decrease and I am not sure how to do that. I know that you can not have 2 different formulas at once within a cell, so I am trying to figure out the combined formula.
Any advice would be great.
never mind, worked it out using SUMIF!
Ok so if I get a thumbs down there is a better way? interested to hear it...

Excel SUM COUNTIFS from different tables and futureproofing

I'm practising MS Excel skills. I have a workbook in which I want to analyses data from different tables.
Each worksheet contains a table with the information from the year. So in worksheet "2017" I have a table named "Table2017". I have this for each year (starting 2015).
After a some research, I finally found a way to count how many times something in a certain place happened.
=SUM(COUNTIFS(Table2018[Place];B3;Table2018[Activity];{"Paid";"Awarded"}))
+SUM(COUNTIFS(Table2017[Place];B3;Table2017[Activity];{"Paid";"Awarded"}))
+SUM(COUNTIFS(Table2016[Place];B3;Table2016[Activity];{"Paid";"Awarded"}))
+SUM(COUNTIFS(Table2015[Place];B3;Table2015[Activity];{"Paid";"Awarded"}))
This works perfectly. It will calculate how many times per place a paid service or an awarded (gifted/sponsored) service was delivered. In the B column, I have a list of places (hence the B3 reference), so after completing the formula, I can select the cell and enlarge/drag to copy it to the rest of the column and apply for every place.
However, the formula is really long and every year upon creating a new worksheet, I need to add a new part to the formula.
Is there a way to compact this? And ideally have the formula search for every table that has the relevant information (like: "Table20??" or "Table 20*"), go in and count the times my conditions are found?
I hope my question is clear enough.
Thanks in advance!
P.S. I have zero experience in VBA/VBS, so I'm hoping to realize this in a normal formula.
There are ways to make it more compact, but they will necessarily make the function more complicated, so it wont be any easy win. See for yourself:
you basically need to be able to cycle through the years inside formula without creating custom formulas. One way to do this is to use ROW inside INDIRECT function. This way you can replace multiple
Table2015[Place]
with one array function containing
INDIRECT("Table"&ROW($A$2015:$A$2018)&"[Place]")
as it is an array function it will essentially cycle through the cells in the ROW function creating Table2015[Place], Table2016[Place], Table2017[Place] and Table2018[Place]. Your whole formula would look something like this
=SUM(COUNTIFS(INDIRECT("Table"&ROW($A$2015:$A$2018)&"[Place]");B3;INDIRECT("Table"&ROW($A$2015:$A$2018)&"[Activity]");{"Paid";"Awarded"}))
and it must be entered using ctrl+shift+enter (you will see {} brackets around the function). This should work to make the function smaller and you will need only to change the cell reference each year instead of adding another sum, but the question is if the separate sums are not easier to read and maintain.

Counting Cells in a Range that Contains Formulas, Only when a Date is Returned?

Frequent browser, first time poster. Please go easy:
I have spent the last few days searching online, and on here for a solution to a problem I have encountered for the first time. I have a report that pulls from multiple worksheets. One column is a formula that does a VLOOKUP to another sheet and pulls back a date, if it exists. I then have a cell at the top of the sheet that calculates how many dates are pulled back out of all of the rows (to calculate % complete). This is where I am having the problem. I have tried variations of COUNTIF, COUNTA, COUNTBLANK, and so on, and formulas trying to reverse calculate,
=SUM(C4)-COUNTIF(Table3[2014 Process Date],"")
At first it appeared to work, but in this example, I had 1949 rows, and dates only populated in 7 of those rows. In theory it should return 7. Instead it is returning 237. I have done multiple filters, and manually reviewed the data in the column, and only 7 dates are there. The column has the VLOOKUP in and IFERROR nest,
=IFERROR(VLOOKUP(A12,Table_TaxData.accdb3[#All],240,FALSE),"").
I am guessing I am overlooking something silly, and was hoping someone would be able to help steer me in the right direction, or let me know what I am missing. Thanks in advance for any help!
Wow, looks like I need some more coffee! Thank you, I guess I assumed that it would be much more complicated than that. I just threw in
=COUNT(Table3[2014 Process Date])
And it worked like a charm! Thanks again!
If I'm reading your formula correctly, the target cells hold either the DATE, or a blank "".
If so, you can do a COUNTIF and do this:
=COUNT(B:B)
to get # of dates.
or
=COUNTA(B:B)-COUNT(B:B)
to get # of blanks.
(I used column B, not sure where your final values are in you're looking for - adjust accordingly)

Conditional Format cell if it's value is found in a Column of a Table

I thought this was going to be Very simple:
=COUNTIF(Foo[Bar],$A1)>0
applying this to the entire column I thought would highlight any cell that is found in the Column Bar of table Foo. But excel is telling me my formula contains an error, even though when I paste it into a cell it does give me a correct value of True/False.
I thought maybe for some reason I needed to complicate it for excel so i tried:
=COUNTIF(Foo[Bar],$A1) + CountIf(A1:A10000, $A1>1
Not sure why i tried it but I figured why not. Regardless is did not work.
I then went on to blame the Range (Foo[Bar]) and tried:
=COUNTIF($T$2:$T$1048576,$A1)>0
It Worked, the issue here is that that table's row count can change from 1 to anything depending on out days progress. I'd prefer not to just use 50000 as a number because it might not always be good enough and most of the time over kill. and causes refreshed to take for ever when Column A is closing in on 1 million records some days and the table is at 100,000.
So, how can I dynamically conditionally format my column to reflect table?
Try
=COUNTIF(INDIRECT("Foo[Bar]"),$A1)>0
Maybe (I've not tested this) it would work with a named range. Say name Foo[Bar] as CheckList and use something like =MATCH($A1,CheckList,0)>0 in CF. This works for an existing table that is extended with entries under [Bar] but I am not sure what would happen for you on table update, though pasting other data over the top of my table does work.
Try:
=COUNTIF(Foo[[#Data],[Bar]],$A1)>0
or if your in this table,
=COUNTIF(Foo[[#Data],[Bar]],Foo[[#This Row],[A Header]])>0
Also a good resource is to use the auto complete feature Excel give you. This will ensure your references are accurate.

Resources