Help Wanted: conditional criteria for IFS-type functions

%3CLINGO-SUB%20id%3D%22lingo-sub-2848075%22%20slang%3D%22en-US%22%3EHelp%20Wanted%3A%20conditional%20criteria%20for%20IFS-type%20functions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2848075%22%20slang%3D%22en-US%22%3E%3CP%3EExcel%202013.%3C%2FP%3E%3CP%3EHow%20do%20I%20create%20an%20in-formula%20conditional%20criteria%20for%20an%20IFS-type%20function's%20criteria%20range%20based%20on%20subtracting%20a%20value%20from%20the%20value%20of%20the%20cell%20at%20the%20foot%20of%20the%20Criteria_range%3F%20What%20I'm%20trying%20to%20to%20is%20select%2Fcount%2Fsum%2Faverage%20rows%20from%20the%20last%20seven%20days%20only%20from%20within%20criteria%20range%20which%20is%20always%20greater%20that%20seven%20rows%2C%20but%20less%20than%20some%20large%20number.%20Each%20row%20has%20a%20date%2C%20and%20some%20unique%20activity%20data%20in%20corresponding%20columns%3B%20some%20days%20have%20multiple%20activities%20(multiple%20rows)%2C%20and%20some%20don't.%20Newer%20data%20is%20added%20to%20the%20bottom%20of%20the%20table.%20The%20data%20is%20sorted%20by%20date%20in%20ascending%20order.%3C%2FP%3E%3CP%3EI've%20tried%2C%20for%20example%3A%3C%2FP%3E%3CP%3EAssume%20the%20bottom%20of%20the%20Criteria_range1%20(column%20D)%20is%20today's%20date%2C%20preceded%20by%20lower%20values%20(previous%20days)%2C%20with%20some%20repeated%20date%20rows.%20The%20Average_range%20I%20want%20is%20in%20column%20E.%20I%20want%20it%20to%20pick%20the%20date%20value%20from%20D25%2C%20subtract%207%2C%20then%20use%20that%20as%20the%20greater-than%20criteria%20for%20averaging%20(or%20summing%20etc)%20rows%20that%20correspond%20to%20a%20date%20value%20of%20%22within%20the%20previous%207%20days%22%20of%20the%20date%20in%20D25.%20But%2C%3C%2FP%3E%3CP%3E%3DAVERAGEIFS(E1%3AE25%2CD1%3AD25%2C%22%26gt%3B(D25-7)%22)%20returns%20only%20the%20%23DIV%2F0!%20error%20code%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3DAVERAGEIFS(E1%3AE25%2CD1%3AD25%2C%22%26gt%3B44477%22)%20returns%20a%20valid%20result%20if%20I%20use%20an%20integer%20date%20value%20instead%20of%20a%20nested%20formula%20to%20create%20the%20date%20value%20I%20want.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20want%20a%20nested%20formula%20to%20compute%20the%20Criteria%20so%20I%20can%20pull%20down%20this%20formula%20for%20every%20row%2C%20and%20extend%20the%20moving%20average%20or%20sum-over-time%20to%20the%20past%2030%20or%20even%20365%20days%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2848075%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2849130%22%20slang%3D%22en-US%22%3ERe%3A%20Help%20Wanted%3A%20conditional%20criteria%20for%20IFS-type%20functions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2849130%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1186022%22%20target%3D%22_blank%22%3E%40Wrfrzlwg%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%3EUse%20IFERROR%20before%20the%20AVERAGEIFS%20formula.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EIf%20average_range%20is%20a%20blank%20or%20text%20value%2C%20AVERAGEIFS%20returns%20the%20%23DIV0!%20error%20value.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%3Eexample%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3A%3C%2FP%3E%3CP%3E%3DIFERROR(AVERAGEIFS(E1%3AE25%2CD1%3AD25%2C%22%26gt%3B(D25-7)%22)%2C%22%22)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20be%20happy%20to%20know%20if%20I%20could%20help.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENikolinoDE%3C%2FP%3E%3CP%3EI%20know%20I%20don't%20know%20anything%20(Socrates)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWas%20the%20answer%20useful%3F%20Mark%20them%20as%20helpful!%3C%2FP%3E%3CP%3EThis%20will%20help%20all%20forum%20participants.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

Excel 2013.

How do I create an in-formula conditional criteria for an IFS-type function's criteria range based on subtracting a value from the value of the cell at the foot of the Criteria_range? What I'm trying to to is select/count/sum/average rows from the last seven days only from within criteria range which is always greater that seven rows, but less than some large number. Each row has a date, and some unique activity data in corresponding columns; some days have multiple activities (multiple rows), and some don't. Newer data is added to the bottom of the table. The data is sorted by date in ascending order.

I've tried, for example:

Assume the bottom of the Criteria_range1 (column D) is today's date, preceded by lower values (previous days), with some repeated date rows. The Average_range I want is in column E. I want it to pick the date value from D25, subtract 7, then use that as the greater-than criteria for averaging (or summing etc) rows that correspond to a date value of "within the previous 7 days" of the date in D25. But,

=AVERAGEIFS(E1:E25,D1:D25,">(D25-7)") returns only the #DIV/0! error code

 

=AVERAGEIFS(E1:E25,D1:D25,">44477") returns a valid result if I use an integer date value instead of a nested formula to create the date value I want.

 

I want a nested formula to compute the Criteria so I can pull down this formula for every row, and extend the moving average or sum-over-time to the past 30 or even 365 days

2 Replies

@Wrfrzlwg 

 

Use IFERROR before the AVERAGEIFS formula.

If average_range is a blank or text value, AVERAGEIFS returns the #DIV0! error value.

 

example:

=IFERROR(AVERAGEIFS(E1:E25,D1:D25,">(D25-7)"),"")

 

I would be happy to know if I could help.

 

NikolinoDE

I know I don't know anything (Socrates)

 

Was the answer useful? Mark them as helpful!

This will help all forum participants.

@Wrfrzlwg 

Use

 

=AVERAGEIFS(E1:E25,D1:D25,">"&D25-7)