Forum Discussion
Excel Formula
=IF(RIGHT(C2,3)="csv",IF(MOD(SUMPRODUCT(N(RIGHT($C$2:C2,3)="csv")),5)=0,"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="csv")),5),"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="csv")),5)+1),IF(RIGHT(C2,3)="abc",IF(MOD(SUMPRODUCT(N(RIGHT($C$2:C2,3)="abc")),5)=0,"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="abc")),5),"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="abc")),5)+1),""))
You are welcome. I'd apply a nested IF formula for multiple domains.
- zayn_mirFeb 07, 2023Copper ContributorThank you OliverScheurich. Unfortunately both of the formulas are showing some error. Any suggestions?
- OliverScheurichFeb 07, 2023Gold Contributor
=IF(RIGHT(C2,3)="csv",IF(MOD(SUMPRODUCT(N(RIGHT($C$2:C2,3)="csv")),5)=0,"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="csv")),5),"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="csv")),5)+1),IF(RIGHT(C2,3)="abc",IF(MOD(SUMPRODUCT(N(RIGHT($C$2:C2,3)="abc")),5)=0,"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="abc")),5),"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="abc")),5)+1),IF(RIGHT(C2,3)="usa",IF(MOD(SUMPRODUCT(N(RIGHT($C$2:C2,3)="usa")),5)=0,"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="usa")),5),"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="usa")),5)+1),IF(RIGHT(C2,3)="zzz",IF(MOD(SUMPRODUCT(N(RIGHT($C$2:C2,3)="zzz")),5)=0,"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="zzz")),5),"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="zzz")),5)+1),IF(RIGHT(C2,3)="edv",IF(MOD(SUMPRODUCT(N(RIGHT($C$2:C2,3)="edv")),5)=0,"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="edv")),5),"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="edv")),5)+1),"")))))
Both formulas work flawlessly and as expected in my sheet. I've expanded the nested IF formula for 5 domains and it returns the intended results. Below i've highlighted the initial criteria of each IF statement for explanation.
=IF(RIGHT(C2,3)="csv",IF(MOD(SUMPRODUCT(N(RIGHT($C$2:C2,3)="csv")),5)=0,"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="csv")),5),"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="csv")),5)+1),
IF(RIGHT(C2,3)="abc",IF(MOD(SUMPRODUCT(N(RIGHT($C$2:C2,3)="abc")),5)=0,"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="abc")),5),"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="abc")),5)+1),
IF(RIGHT(C2,3)="usa",IF(MOD(SUMPRODUCT(N(RIGHT($C$2:C2,3)="usa")),5)=0,"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="usa")),5),"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="usa")),5)+1),
IF(RIGHT(C2,3)="zzz",IF(MOD(SUMPRODUCT(N(RIGHT($C$2:C2,3)="zzz")),5)=0,"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="zzz")),5),"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="zzz")),5)+1),
IF(RIGHT(C2,3)="edv",IF(MOD(SUMPRODUCT(N(RIGHT($C$2:C2,3)="edv")),5)=0,"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="edv")),5),"Agent ""IENT(SUMPRODUCT(N(RIGHT($C$2:C2,3)="edv")),5)+1),"")))))
- zayn_mirFeb 08, 2023Copper ContributorThanks a lot OliverScheurich. I really appreciate your help. One quick question, can we use the formula provided by you for the whole domain name (etc; email.com, e.com, test.com)? As of now the formula is just working for the domain that comes after (.) (etc; com, uvw, abc)