Need help in Formula

chesterrae

Board Regular
Joined
Dec 23, 2015
Messages
51
Hi All,

Could you please help me in this? Currently I have 20K+ rows of data that's why I need a formula that will return "Tier 2" and "Tier 3" in column (D) Tier.


here are the conditions:

Tier 2, if there are 2 or more unique Order ID within the last 12 months per Account Name.
Tier 3, if there are only 1 unique Order ID within the last 12 months per Account Name.

25i947t.jpg



Thank you so much in advance!
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Please refer on this sample instead.

Excel 2007 32 bit
A
B
C
D
1
Order IDAccount NameOrder DateTier
2
18JBP5008Robert Downey Jr
10/1/2018​
Tier 3
3
18JBP5008Robert Downey Jr
10/1/2018​
Tier 3
4
18JAK0336Chris Evans
10/1/2018​
Tier 2
5
18JAK0336Chris Evans
10/1/2018​
Tier 2
6
18JAK0335Chris Evans
10/1/2018​
Tier 2
7
18JAP2322Chris Hemsworth
1/1/2017​
8
18JAP2322Chris Hemsworth
11/21/2017​
Tier 3
9
18JAP2322Chris Hemsworth
12/21/2017​
Tier 3
10
18JAP2322Chris Hemsworth
10/1/2018​
Tier 3
11
18JAN1058Scarlett Johansson
10/1/2018​
Tier 3
12
18JDM5411Jeremy Renner
8/2/2017​
13
18JDM5411Samuel Jackson
8/10/2017​
14
18JDM5412Samuel Jackson
10/2/2018​
Tier 3
15
18JBM3812Mark Ruffalo
10/2/2018​
Tier 2
16
18JBM3813Mark Ruffalo
10/3/2018​
Tier 2
17
18JBM3814Mark Ruffalo
10/3/2018​
Tier 2
Sheet: Sheet1
 
Upvote 0
Great, thanks. How do we define "last 12 months" -- 12 months back from today until today or are we going to use max current date instead of today?
 
Upvote 0
It should be Today() function.

In D2 control=shift+enter, not just enter, and copy down:

=LOOKUP(SUM(IF(FREQUENCY(IF($A$2:$A$17<>"",IF($B$2:$B$17=B2,IF($C$2:$C$17>=EDATE(TODAY(),-12),IF($C$2:$C$17<=TODAY(),MATCH($A$2:$A$17,$A$2:$A$17,0))))),ROW($A$2:$A$17)-ROW($A$2)+1),1)),{0,"";1,"Tier 3";2,"Tier 2"})
 
Upvote 0
In D2 control=shift+enter, not just enter, and copy down:

=LOOKUP(SUM(IF(FREQUENCY(IF($A$2:$A$17<>"",IF($B$2:$B$17=B2,IF($C$2:$C$17>=EDATE(TODAY(),-12),IF($C$2:$C$17<=TODAY(),MATCH($A$2:$A$17,$A$2:$A$17,0))))),ROW($A$2:$A$17)-ROW($A$2)+1),1)),{0,"";1,"Tier 3";2,"Tier 2"})


I noticed Chris Hemsworth and Samuel Jackson was been populated as Tier 3 which is incorrect. They should be blank since their Order Date was 1/12017 and 8/10/2017 which is not less than 12months from today.

Excel 2007 32 bit
A
B
C
D
E
1
Order IDAccount NameOrder DateTier (Should be the result)
2
18JBP5008Robert Downey Jr
10/1/2018​
Tier 3Tier 3
3
18JBP5008Robert Downey Jr
10/1/2018​
Tier 3Tier 3
4
18JAK0336Chris Evans
10/1/2018​
Tier 2Tier 2
5
18JAK0336Chris Evans
10/1/2018​
Tier 2Tier 2
6
18JAK0335Chris Evans
10/1/2018​
Tier 2Tier 2
7
18JAP2322Chris Hemsworth
1/1/2017​
Tier 3
8
18JAP2322Chris Hemsworth
11/21/2017​
Tier 3Tier 3
9
18JAP2322Chris Hemsworth
12/21/2017​
Tier 3Tier 3
10
18JAP2322Chris Hemsworth
10/1/2018​
Tier 3Tier 3
11
18JAN1058Scarlett Johansson
10/1/2018​
Tier 3Tier 3
12
18JDM5411Jeremy Renner
8/2/2017​
13
18JDM5411Samuel Jackson
8/10/2017​
Tier 3
14
18JDM5412Samuel Jackson
10/2/2018​
Tier 3Tier 3
15
18JBM3812Mark Ruffalo
10/2/2018​
Tier 2Tier 2
16
18JBM3813Mark Ruffalo
10/3/2018​
Tier 2Tier 2
17
18JBM3814Mark Ruffalo
10/3/2018​
Tier 2Tier 2
Sheet: Sheet1
 
Upvote 0
In D2 control+shift+enter and copy down:

=IF(AND(C2>=EDATE(TODAY(),-12),C2<=TODAY()),LOOKUP(SUM(IF(FREQUENCY(IF($A$2:$A$17<>"",IF($B$2:$B$17=B2,MATCH($A$2:$A$17,$A$2:$A$17,0))),ROW($A$2:$A$17)-ROW($A$2)+1),1)),{0,"";1,"Tier 3";2,"Tier 2"}),"")
 
Upvote 0
In D2 control+shift+enter and copy down:

=IF(AND(C2>=EDATE(TODAY(),-12),C2<=TODAY()),LOOKUP(SUM(IF(FREQUENCY(IF($A$2:$A$17<>"",IF($B$2:$B$17=B2,MATCH($A$2:$A$17,$A$2:$A$17,0))),ROW($A$2:$A$17)-ROW($A$2)+1),1)),{0,"";1,"Tier 3";2,"Tier 2"}),"")


Just one incorrect, but it's almost!

Excel 2007 32 bit
A
B
C
D
E
1
Order IDAccount NameOrder DateTier (Should be the result)
2
18JBP5008Robert Downey Jr
10/1/2018​
Tier 3Tier 3
3
18JBP5008Robert Downey Jr
10/1/2018​
Tier 3Tier 3
4
18JAK0336Chris Evans
10/1/2018​
Tier 2Tier 2
5
18JAK0336Chris Evans
10/1/2018​
Tier 2Tier 2
6
18JAK0335Chris Evans
10/1/2018​
Tier 2Tier 2
7
18JAP2322Chris Hemsworth
1/1/2017​
8
18JAP2322Chris Hemsworth
11/21/2017​
Tier 3Tier 3
9
18JAP2322Chris Hemsworth
12/21/2017​
Tier 3Tier 3
10
18JAP2322Chris Hemsworth
10/1/2018​
Tier 3Tier 3
11
18JAN1058Scarlett Johansson
10/1/2018​
Tier 3Tier 3
12
18JDM5411Jeremy Renner
8/2/2017​
13
18JDM5411Samuel Jackson
8/10/2017​
14
18JDM5412Samuel Jackson
10/2/2018​
Tier 2Tier 3
15
18JBM3812Mark Ruffalo
10/2/2018​
Tier 2Tier 2
16
18JBM3813Mark Ruffalo
10/3/2018​
Tier 2Tier 2
17
18JBM3814Mark Ruffalo
10/3/2018​
Tier 2Tier 2
Sheet: Sheet1
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,603
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top