Forum Discussion
Excel Formula
- OliverScheurichFeb 01, 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),""))
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),"")))))