Use date values from different sheet in formula - excel

I have two sheets in my excel file.
The first sheet contains values and dates, on the second I want to calculate values between a date range.
for instance:
50 20/9/2014
1600 16/10/2014
254 21/10/2014
1547 03/11/2014
(Belgian time)
I tried this with the following formula:
=SUMIFS(INPUT!$G$3:$G$100; INPUT!$H$3:$H$27; ">=01/10/2014"; INPUT!$H$3:$H$27; "<=31/10/2014")
This gives me an error in the formula and I notice that inside the formula values the date has become a random value:
Anyone has an idea how to do this correctly?

I couldn't find it at first either, but it seems your ranges need to be the same size (sum_range and criteria).
So change your sum_range to G3:G37 or your criteria range to H3:H100 and it will solve your problem. :)
Reference: http://www.excelforum.com/excel-formulas-and-functions/731875-sumifs-returns-value.html

Related

Excel Formula to Calculate Text within a date range

I am trying to calculate values within a specific date range. The data I want to split between each month and the values: Successful, Incomplete and Failed.
I've tried pivot tables with this data but it doesn't work for me, also lacking pivot table excel experience. Formulas I'm more comfortable with.
I am using the following statement to at least get the total number of a value I add into it;
=COUNTIF('Jan 19'!$C$2:$C$1159,"Value")
Ex. If I put into the value "Successful" I get the total number of successful records.
I am looking into having a formula that I can input a specific month/date range (Jan, Feb, etc) and a value to get a count.
Ex. =Formula ((RangeOfData, "Value") AND (RangeOfData, (FromDate, ToDate))
I expect to the get the total number of a value(s) within a specific date range. If there isn't any data then the results would be blank or 0.
I'd use the formula COUNTIFS() as #cybernetic.nomad pointed in the comments so you can put more conditions on the COUNT:
=+COUNTIFS('Jan 19'!$B$2:$B$1159,">="&F3,'Jan 19'!$B$2:$B$1159,"<"&G3,'Jan 19'!$C$2:$C$1159,H3)
In the formula above I guessed the dates are in the COLUMN B, if not, you need to change it in the formula above.
To do that we should put the range we want to look at in a couple of cells where you would put the date range, in the example above:
F3 is the start date (if you want February of this year should be 1/2/2019).
G3 is the final date (if you want February of this year should be 1/3/2019).
H3 is where you can write "value", "successful" or any other string you are trying to count.

Excel - SUMIFS - dynamic sum range for table

In my source data I've got a columns with data for every month and for few years.
In my working spreadsheet I want to sum the source data with 4 criteria. 3 of them are constant and one is dynamic (Month&Year). Depends on the chosen month and year I want to sum correct column in source data.
I've found a similar topic - link below:
SUMIF dynamically change summing column
However, I am getting #Values error if I input a formula. I've check that all data is text and compare with Exact function as well.
Below is my formula:
=SUMIFS(INDEX(IBRACT[#All];0;MATCH(Sheet3!G$1;IBRACT[#Headers];0));IBRACT[Entity];$A$1;IBRACT[SKU];$D14)
IBRACT is the name of table.
Below is the link to screen of evaluation (in this example I wanted to sum 6th column which in the spreadsheet is column "F"). Next step of evaluation shows #Value.
https://imgur.com/JHq80BM
Have anybody any idea how to solve this problem?
Best,
Wiktor
IBRACT[#All] includes the header row which is one row more than the two criteria ranges, hence the #VALUE! error. Just change the sum range to only include the data body range.
=SUMIFS(INDEX(IBRACT; 0; MATCH(Sheet3!G$1; IBRACT[#Headers]; 0)); IBRACT[Entity]; $A$1; IBRACT[SKU]; $D14)

COUNTIFS and SUMPRRODUCT for unique text within a date range for all rows

I am trying to use COUNTIFS and SUMPRODUCT to count the number of unique text for a date within certain range for all rows.
For example, I would like to count the number of unique count for the items that are in February.
Date, Item Description, , Start, 2017-02-01
02/1/2017, abc, , End, 2017-03-01
03/2/2017, def
05/2/2017, abc
08/2/2017, def
01/3/2017, abc
05/3/2017, def
If I specify the range like this (i.e. from row 1 to 6), it does work and return 2.
=SUMPRODUCT((($A1:$A6>=$E1)*($A1:$A6<$E2))/COUNTIFS($B1:$B6, $B1:$B6, $A1:$A6, ">="&$E1, $A1:$A6, "<"&$E2))
However, if I specify the whole column it won't work and return 0.
=SUMPRODUCT((($A:$A>=$E1)*($A:$A<$E2))/COUNTIFS($B:$B, $B:$B, $A:$A, ">="&$E1, $A:$A, "<"&$E2))
Please suggest how can I fix this to do for all rows?
Probably more efficient to use an array formula with FREQUENCY, and that type of formula can cope with blank rows so you should just make the range large enough to cater for current data and possible future expansion, e.g. for data in rows 2 to 1000 you can use an array formula like this:
=SUM(IF(FREQUENCY(IF(A$2:A$1000>=E1,IF(A$2:A$1000<E2,MATCH(B$2:B$1000,B$2:B$1000,0))),ROW(B$2:B$1000)-ROW(B$2)+1),1))
confirm with CTRL+SHIFT+ENTER
You could use a dynamic named range e.g. Dates and enter this into the formula. It will then only evaluate for the required number of rows. Won't have the added luxury of barry houdini's answer which caters for blank cells in the range.
Ctrl + F3 will open the Name Manager and there you can click > New and enter Dates for the name and use a variation on the following formula for the Refers to:
=OFFSET(Sheet1!$A$2,0,0,COUNT(Sheet1!$A$2:$A$1048576),1)
The $A$1048576 is the last row in versions of Excel above 2003 and $A$65536 would be for before.
=SUMPRODUCT(((Dates>=$E1)*(Dates<$E2))/COUNTIFS(OFFSET(Dates,,1,,1), OFFSET(Dates,,1,,1), Dates, ">="&$E1, Dates, "<"&$E2))

Linking IF statement (criteria in single column) with SUMIFS (criteria spans range of columns)

I've run into an issue with trying to sumifs across a range of columns. The way the data is structured, I have a range of countries (column B-H) and a row of associated numbers (column I-O). I'd like to sum the volumes with associated countries (ex: XX for Afghanistan) - however, there's a catch. I only want to sum across those columns if another criteria (denoted by "yes use this") appears in column FI. I'm having a hard time getting all of these pieces to work together -- any ideas??
Attempt 1:
=SUMIFS(I5:O1000,B5:H1000,"Afghanistan",FI5:FI1000,"yes use this")
Result : = #VALUE error
I'm assuming this is because the ranges don't match (B5:H1000 spans 7 columns, FI5:FI1000 spans 1).
Attempt 2:
=SUMIFS(I5:I1000,B5:B1000,"Afghanistan",FI5:FI1000,"Yes use this")
Result: the correct number
The above assumption was correct, but then this doesn't solve my problem. I don't want to have to copy and repeat the formula for each column.
Attempt 3:
=IF(FI5:FI1000="Yes use this", SUMIFS(I5:I1000,B5:B1000,"Afghanistan"),"FAILED")
Instead of pulling back the correct number, the formula spits out FAILED - which is incorrect.
Any thoughts are appreciated, thanks!
You can try:
=SUM(IF(B5:H1000="Afghanistan",IF(FI5:FI1000="yes use this",I5:O1000,0),0))
entered as an array formula (CTRL-ENTER)

Median on weekdays

I'm trying to determine the median of a set of data for each weekday. Currently, the data is in two columns, date and value. Some of the value rows are blank, as the data to be analyzed hasn't be entered yet. I've had a look at the median-if array formula, but when I combine it with Weekday function I just get an error
{=Median(if(Weekday('Data'!A:A)=1, 'Data'!B:B)}
This is the current formula I'm working with to calculate the median value for Sundays, and all I get out of it #VALUE!.
Copying a Comment from #sous2817:
Rather than use a whole column reference, you should just use the range you want to evaluate for the calculation. If you have something other than a date in Column A, it will throw the #Value error.

Resources