Median on weekdays - excel

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.

Related

To return the last value in a row for Date and Person to Action (VBA)

I wish to construct 2 current status columns so as find the last values in each row in Excel:
one for the last Date and the other for the last person who needs to act.
Please see the attached jpg To return the last values in a row for Date and Person to Act
I have tried to use the excel functions, namely, INDEX or LOOKUP but to no avail because of the 3 Remarks columns within the table.
I would appreciate it if you could advise me how to craft a VBA code to the above query.
From LC TAN 2020-02-13
You're on the right track.
you can use LOOKUP to return the last element in an array
BUT you have to ensure your array only has the elements that you want to consider
There is a variation of the INDEX function where you can enter an array for the column (or row) argument and return selected items. You enter the array, or arra constant, in a format like:
N(IF(1,*array or arrayConstant*))
So, a formula that would work for your requirements would be:
L6: =LOOKUP(2,1/LEN(INDEX($B6:$J6,N(IF(1,{2,5,8})))),INDEX($B6:$J6,N(IF(1,{2,5,8}))))
and fill down.
You can use MAX for the date to find the latest date in that row.
You can then use IFERROR and VLOOKUP to find the action with that date. i.e. lookup the date that MAX has returned in the first set of columns, and if that returns an error, look in the second. If the second returns an error, look in the third.
As per your sheet, the formula for L6 would be =MAX(B5:I5)
The formula for M6 would be =IFERROR(VLOOKUP(L5,B5:C5,2,FALSE),IFERROR(VLOOKUP(L5,E5:F5,2,FALSE),VLOOKUP(L5,H5:I5,2,FALSE)))
You can then drag the cells down to populate the date and action for every row. You could achieve the same with VBA if you wanted to, but I would have thought that this is the easiest way to get the the desired result.

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.

Can't get CUBEVALUE to filter by date value in cell

My data model has a column named rowDate. This column has several repeating instances of dates due to the fact that there are multiple rows of data for different times of a single day.
I've written a measure that sums the values in another column from the data model that I want to pull from. (We'll call this MyMeasure.)
I'm trying to write a CUBEVALUE formula that extracts the total of MyMeasure when rowDate equals the value of a cell in a worksheet. (This will allow the result of the CUBEVALUE to change based on the date that the user inputs into cell B2.)
e.g.
Cell B2 = "2018-06-29" (date formatted)
=CUBEVALUE("ThisWorkbookDataModel","[MyMeasure]","[Summary Data].[rowDate].["&$B$2&"]")
This always returns #N/A. I have another column with data (a number) that I can write the exact same CUBEVALUE formula, but referencing the appropriate cell, and it works just fine. It's just this date column that I can't figure out.
Found the solution in this thread. The trick is to format the date in your targeted cell inline using the TEXT function to match the cube's default date format (YYYY-MM-DDTHH:MM:SS).
=CUBEVALUE("ThisWorkbookDataModel","[Measures].[MyMeasure]","[Summary Data].[rowDate].&["&TEXT($B$2,"YYYY-MM-DDTHH:MM:SS")&"]")

Excel Array Formula, Multiple criteria

I have a table in which multiple weeks of data is stored and I'm trying to return a value based on 2 criteria.
Column A of the data sheet contains the date the report was ran (Always on the same day of the week - 24/05/17, 31/05/17 etc)
I've managed to return the value of column H by using an array formula, based on a cell value (Date) in ''Issues Data Quality Overview'!$B$4' using the following formula:
{=IFERROR(INDEX('Issues Log'!$H$1:$H$20000,SMALL(IF('Issues Data Quality Overview'!$B$4='Issues Log'!$A$1:$A$20000,ROW('Issues Log'!$A$1:$A$20000)-MIN(ROW('Issues Log'!$A$1:$A$20000))+1,""), ROW(A2))),"")}
That returns a value such as "IID-10225-22".
Problem:
Now I need to look up that value in the same table, based on a date in another cell, and return column X. (essentially adding the returned value as a criteria).
In all honesty I'm lost as to how I'd do this.
#Matthew. I understand your formula gives the list of values in column H with column A values matching 'Issues Data Quality Overview'!$B$4 in an ordered list.
Does your Issues Log, column H have multiple occurrence of the same value? (example: IID-10255-22 can have a value in Issues Log, column A that is not the same value as 'Issues Data Quality Overview'!$B$4).
If not, it doesn't make sense to use the result as a lookup value to get column X, you can simply change the code to:
{=IFERROR(INDEX('Issues Log'!$X$1:$X$20000,...}
If it does have multiple occurrences and you want to get the first occurrence of the result in column H and get the value in column X, best to add a formula right next to your array formula and do a VLOOKUP.
I've scrapped the array formula, as it really slowed down the processing speed. Instead I've created a Unique ID (=IssueID&Date) and VLookup'd that.

Use date values from different sheet in formula

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

Resources