'Creating a binary flag to return whether someone has used a product in the last n days

I have three variables: the person using the item, the date the item was used, and the brand. I'd like to create a flag that indicates whether a specific brand (in this case, BrandA) was used in the last n days by a given person.

The Y-AA columns are an example of the data that I'm working with, and the AB column is the desired result.

Example

I know at the end I'll probably have =if( , True, False), but I'm not sure what would make up the argument.

Any help would be appreciated, thank you!



Solution 1:[1]

I think you need to consider how you're setting up your data. Below is an example of how you can create your IF conditions to make it work -- using data that is unclear in your post.

Set up your data like so, with cell Z1 using the name AnchorDate.

enter image description here

Then the formula entered in cell AB4 and copied down and across will be

=IF(AND($Y4=AB$1,$AA4=AB$2,DAYS(AnchorDate,$Z4)<=10),"Yes","No")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 PeterT