Not sure how to do this countifs function correctly - excel

I have this table below
What I want is able to pivot for number of items(column) ordered by days (row). I'm not sure how to do it smartly. So I thought of a way which is to create a table below
However, when I tried writing a countifs, it gives me error. What I tried for each row was:
=countifs(range of item 1 to item 3, that item, range of the whole Order Date column, that date). But it throws me an #VALUE error. More details below
So yeah, I'm stuck. Can someone please help? I'm using Excel 2019 by the way

For COUNTIFS function each additional range must have the same number of rows and columns as first range.
But I can suggest the SUMPRODUCT function:
=SUMPRODUCT(([#Item]=Table1[[Item 1]:[Item 3]])*([#Date]=Table1[Order Date]))

Related

Excel Formula Vlookup the value by referring Row and Column

In the sheet1 i have a table called working days of the countries as shown in the below image.
In the Sheet2 i have 10 columns in that based on the country and month by referring the this table i am trying to populate the values, When i tried doing by Vlookup the first row alone getting populated, but in the second row the header from F1:T1 is getting changed to F2:T2 so rest of the cells showing as #NA.
Anyone can you please give a solution for my issue. Here is the formula i have used.
=VLOOKUP(I1,Sheet1!F2:T7,MATCH(Sheet2!M1,Sheet1!F1:T1,0))
Thanks in Advance.
You are missing the symbol $ to lock the ranges, and the false condition to match exact values in the VLOOKUP.
It should be like:
=VLOOKUP(I1,Sheet1!$F$2:$T$7,MATCH(M1,Sheet1!$F$1:$T$1,0),0)
Or instead of VLOOKUP use HLOOKUP like:
=HLOOKUP(M1,Sheet1!$F$1:$T$7,MATCH(I1,Sheet1!$F$2:$F$7,0),0)
In general, combining the INDEX and MATCH functions is a superior option to VLOOKUP. For example, =INDEX(Sheet1!F:F,MATCH(Sheet2!M1,Sheet1!F1:T1,0)). This allows you to go left-to-right or right-to-left as well.
Snip for Index Match functions Using Vlookup won't work here because in the 2nd table you are repeating the country, unlike the first table. Use a combination of index match function, this is little trickier than the vlookup but it will fulfill your requirements.
Since I don't have the exact table you shared so I created a table on my end and sharing the snip here.

How can I get Excel's LOOKUP function to handle two separate array criteria?

I could use some help with Excel's LOOKUP function please...
I have this formula designed to reference the last value (they are dates) in a row (non blank) and then return me the value in the title row above it. This one works great...
=INDEX($L$4:$BB16,1,((LOOKUP(2,1/(L16:BB16<>""),COLUMN(L16:BB16)))-10))
However I now need to also add the criteria that the date can not be bigger than today's date. So I've added an AND function in the criteria hoping that would do the trick as follows:
=INDEX($L$4:$BB10,1,((LOOKUP(2,1/(AND(ISNUMBER(L10:BB10),L10:BB10<=TODAY())),COLUMN(L10:BB10)))-10))
but this formula doesn't seem to be working. I'm not too sure why. In a nutshell I need the Lookup function to be able to handle two criteria (not blank and also date less than today). Any thoughts or advice??
Thanks!
Use:
=INDEX($4:$4,AGGREGATE(14,6,COLUMN(L16:BB16)/((L16:BB16<>"")*(L16:BB16<=TODAY())),1))

Excel SUMIF Function with Multiple Criteria for One Range (not SUMIFS)

UPDATE 2
Here is my formula and the resulting error. There are "#DIV/0" results in column J in some of the March data.
END OF UPDATE 2
UPDATE
So as you can, I am trying to sum up column J for each month (those totals will go in column R-W). So I need to the SUMIF function to look at data that begins with a certain date, which I was able to figure out, but also to not include anything in the sum that is an error.
END OF UPDATE
I've looked around for a bit for an answer to this question but what I am finding is people are using SUMIF when they are looking at two different ranges; not what I'm trying to do.
I am trying to do a SUMIFS that looks at ONE range and has multiple criteria.
For example, I have 262,025 rows in this file. I am trying to write a function that does a summation only if the date begins with 2016/03. The problem is, the data I am actually summing contains some "#DIV/0" errors in it.
This is what I was thinking:
SUMIF(E6:E262025, AND("2016/03*", <>"#DIV/0", J6:J262025)
This does not work though.
Basically, I want to sum up column J only if the month is March and I want to exclude any of the values in column J that are "#DIV/0". If this is indeed a SUMIFS function then my apologies. I looked at the syntax for that function and I didn't think that was what I needed. Looking forward to some feedback.
A simple SUMIFS will do:
=SUMIFS(J:J,E:E,"<=3/31/2016",E:E,">=3/1/2016")
It will ignore the errors.
EDIT
Now that you posted a picture it is obvious that your dates are not actually dates but text that look like dates. Then you can use this simple SUMIF:
=SUMIF(E:E,"2016/3*",J:J)
Again it will ignore the error.
Edit #2
If the errors are in the value column then we will need to use an array formula that ignores them:
=SUM(IF(ISNUMBER(SEARCH("2016/03",E6:E262025))*(ISNUMBER(J6:J262025)),J6:J262025))
Being an array formula it must be confirmed with Ctrl-Shift-Enter upon exiting Edit Mode instead of Enter. If done correctly then Excel will put {} around the formula.

COUNTIF running into problems with DataTypes

Basically I want to search 2 columns. IF any number in any of the columns is 1, I want to total it up.
here is my formula:
COUNTIF(('Background data'!$A:$A,'Background data'!B:B), 1).
However, when I apply it, I get an error saying 'Value used in the formula is the wrong data type'.
To fix this issue, I went to the Background Data tab and
Set all Columns to Numerical data type
Set all columns to Numerical data type in the tab that I am currently working on
Individually tested the countif formula with either column A and then column B and then I don't receive the error. This concludes that my columns are of the correct data type.
I am guessing I'm getting the error because there is an error in my formula and not the actual data?
Try breaking it up into 2 countif statements:
=COUNTIF('Background data'!$A:$A,1)+COUNTIF('Background data'!B:B, 1)
I want to search 2 columns. IF any number in any of the columns is 1, I want to total it up.
A COUNTIF function can count multiple columns at once.
=COUNTIF('Background data'!A:B, 1)
Since summing a bunch of ones is the same as counting them, a SUMIF function could do this as well.
=SUMIF('Background data'!A:B, 1)
How do you plan on using Countif()? Your formula, as above, has an extra number. Just use =Countif('Background data'!$A:$A,'Background data'!B:B).
What's the extra , 1) doing?

Countif : Trying to count multiple values from a filtered column?

I am trying to count values in a column which is filtered by values in another column. Got it to work using the countifs however I want to count 2 value sets in the filtered column can't seem to get it to count both. So below is the currently working formula.
=COUNTIFS(June!K2:K1000,"username",June!I2:I1000,"=cancelled")
What I want to do is
=COUNTIFS(June!K2:K1000,"username",June!I2:I1000,"=cancelled"+"=no show")
But cant seem to get it to function. Any help much appreciated. Thanks
COUNTIFS(June!K2:K1000,"username",June!I2:I1000,"=cancelled")+COUNTIFS(June!K2:K1000,"username",June!I2:I1000,"=no show")
This should work for you if i understand what you want this formula to do
You can get "OR" behaviour without repeating the COUNTIFS function by using this syntax:
=SUM(COUNTIFS(June!K2:K1000,"username",June!I2:I1000,{"cancelled","no show"}))
The COUNTIFS function returns a two value "array" (one each for cancelled and no show), so you need the SUM function to sum both counts to give your total
This should give the same result as poof's suggestion with 2 COUNTIFS

Resources