Extensive Excel Formula

jeongs1

New Member
Joined
May 23, 2017
Messages
44
Please see below screenshot.
Column J and I are the ones where I need help with. I have tried "countifs" with multiple scenarios, yet cannot get to work exactly how I picture it.

* Does the customer have one contract with one service type for the entire year? If so, return SYSR (Single Year Single Rev)
* Does the customer have one contract with multiple services for the entire year? If so, return SYMR (Single Year Multi Rev)
* Does the customer have multiple contracts signed at the same time with one service? If so, return MYSR (Multi Year Single Rev)
* Does the customer have multiple contracts signed at the same time with multiple services? If so, return MYMR (Multi Year Multi Rev)

[TABLE="width: 1000"]
<colgroup><col><col><col><col><col><col span="2"><col><col><col><col></colgroup><tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Customer ID[/TD]
[TD]Service Type[/TD]
[TD]Contract ID[/TD]
[TD]Contract Start Date[/TD]
[TD]Contract End Date[/TD]
[TD]Contract Entered Date[/TD]
[TD]Contract Amount[/TD]
[TD]Type[/TD]
[TD]Revenue Month[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]1[/TD]
[TD]Cleaning[/TD]
[TD]2[/TD]
[TD]1/1/2019[/TD]
[TD]12/31/2019[/TD]
[TD]12/15/2018[/TD]
[TD]5,000.00[/TD]
[TD]SYSR[/TD]
[TD="align: right"]12[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]100[/TD]
[TD]Cleaning[/TD]
[TD]35[/TD]
[TD]3/1/2019[/TD]
[TD]12/31/2019[/TD]
[TD]12/15/2018[/TD]
[TD]2,000.00[/TD]
[TD]SYMR[/TD]
[TD="align: right"]10[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]100[/TD]
[TD]Maintenance[/TD]
[TD]35[/TD]
[TD]3/1/2019[/TD]
[TD]12/31/2019[/TD]
[TD]12/15/2018[/TD]
[TD]3,000.00[/TD]
[TD]SYMR[/TD]
[TD="align: right"]10[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]582[/TD]
[TD]Maintenance[/TD]
[TD]79[/TD]
[TD]4/1/2019[/TD]
[TD]3/31/2020[/TD]
[TD]2/15/2018[/TD]
[TD]3,000.00[/TD]
[TD]MYSR[/TD]
[TD="align: right"]24[/TD]
[TD]*24 because two contracts signed/entered at the same time[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]582[/TD]
[TD]Maintenance[/TD]
[TD]80[/TD]
[TD]4/1/2020[/TD]
[TD]3/31/2021[/TD]
[TD]2/15/2018[/TD]
[TD]5,000.00[/TD]
[TD]MYSR[/TD]
[TD="align: right"]24[/TD]
[TD]*24 because two contracts signed/entered at the same time[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]76[/TD]
[TD]Cleaning[/TD]
[TD]123[/TD]
[TD]2/1/2019[/TD]
[TD]1/31/2019[/TD]
[TD]1/15/2019[/TD]
[TD]3,000.00[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]76[/TD]
[TD]Installation[/TD]
[TD]123[/TD]
[TD]2/1/2019[/TD]
[TD]1/31/2019[/TD]
[TD]2/1/2019[/TD]
[TD]1,000.00[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]76[/TD]
[TD]Maintenance[/TD]
[TD]123[/TD]
[TD]2/1/2019[/TD]
[TD]1/31/2019[/TD]
[TD]1/15/2019[/TD]
[TD]3,000.00[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]76[/TD]
[TD]Cleaning[/TD]
[TD]254[/TD]
[TD]2/1/2020[/TD]
[TD]1/31/2021[/TD]
[TD]2/1/2019[/TD]
[TD]2,500.00[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]76[/TD]
[TD]Installation[/TD]
[TD]254[/TD]
[TD]2/1/2020[/TD]
[TD]1/31/2021[/TD]
[TD]1/15/2019[/TD]
[TD]1,500.00[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]76[/TD]
[TD]Maintenance[/TD]
[TD]254[/TD]
[TD]2/1/2020[/TD]
[TD]1/31/2021[/TD]
[TD]2/1/2019[/TD]
[TD]3,750.00[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Any thoughts? My brain is too fried! HELP!!!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Re: Extensive Excel Formula Help!

Hi jeongs1,

I think with the help of 2 helper columns (which can be used in the formula in column J of the below data if required) we might get what you are looking for. For revenue month I have attempted based on what I could understand looking at the data. Let me know if that does not work for you.

ABCDEFGHIJK
Customer IDService TypeContract IDContract Start DateContract End DateContract Entered DateContract AmountHelper 1Helper 2TypeRevenue month
CleaningSYSR
CleaningSYMR
MaintenanceSYMR
MaintenanceMYSR
MaintenanceMYSR
CleaningMYMR
InstallationMYMR
MaintenanceMYMR
CleaningMYMR
InstallationMYMR
MaintenanceMYMR

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]1[/TD]

[TD="align: right"]2[/TD]
[TD="align: right"]1/1/2019[/TD]
[TD="align: right"]12/31/2019[/TD]
[TD="align: right"]12/15/2018[/TD]
[TD="align: right"]5000[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]

[TD="align: right"]12[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]100[/TD]

[TD="align: right"]35[/TD]
[TD="align: right"]3/1/2019[/TD]
[TD="align: right"]12/31/2019[/TD]
[TD="align: right"]12/15/2018[/TD]
[TD="align: right"]2000[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]2[/TD]

[TD="align: right"]10[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]100[/TD]

[TD="align: right"]35[/TD]
[TD="align: right"]3/1/2019[/TD]
[TD="align: right"]12/31/2019[/TD]
[TD="align: right"]12/15/2018[/TD]
[TD="align: right"]3000[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]2[/TD]

[TD="align: right"]10[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]582[/TD]

[TD="align: right"]79[/TD]
[TD="align: right"]4/1/2019[/TD]
[TD="align: right"]3/31/2020[/TD]
[TD="align: right"]2/15/2018[/TD]
[TD="align: right"]3000[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]2[/TD]

[TD="align: right"]24[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"]582[/TD]

[TD="align: right"]80[/TD]
[TD="align: right"]4/1/2020[/TD]
[TD="align: right"]3/31/2021[/TD]
[TD="align: right"]2/15/2018[/TD]
[TD="align: right"]5000[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]2[/TD]

[TD="align: right"]24[/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]76[/TD]

[TD="align: right"]123[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]1/31/2019[/TD]
[TD="align: right"]1/15/2019[/TD]
[TD="align: right"]3000[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]6[/TD]

[TD="align: right"]0[/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]76[/TD]

[TD="align: right"]123[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]1/31/2019[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]1000[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]6[/TD]

[TD="align: right"]0[/TD]

[TD="align: center"]9[/TD]
[TD="align: right"]76[/TD]

[TD="align: right"]123[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]1/31/2019[/TD]
[TD="align: right"]1/15/2019[/TD]
[TD="align: right"]3000[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]6[/TD]

[TD="align: right"]0[/TD]

[TD="align: center"]10[/TD]
[TD="align: right"]76[/TD]

[TD="align: right"]254[/TD]
[TD="align: right"]2/1/2020[/TD]
[TD="align: right"]1/31/2021[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]2500[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]6[/TD]

[TD="align: right"]12[/TD]

[TD="align: center"]11[/TD]
[TD="align: right"]76[/TD]

[TD="align: right"]254[/TD]
[TD="align: right"]2/1/2020[/TD]
[TD="align: right"]1/31/2021[/TD]
[TD="align: right"]1/15/2019[/TD]
[TD="align: right"]1500[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]6[/TD]

[TD="align: right"]12[/TD]

[TD="align: center"]12[/TD]
[TD="align: right"]76[/TD]

[TD="align: right"]254[/TD]
[TD="align: right"]2/1/2020[/TD]
[TD="align: right"]1/31/2021[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]3750[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]6[/TD]

[TD="align: right"]12[/TD]

</tbody>
Sheet8

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]J2[/TH]
[TD="align: left"]=IF(AND(H2=1,I2=1),"SYSR",IF(AND(H2=1,I2>1),"SYMR",IF(AND(H2>1,I2>1),IF(H2=I2,"MYSR","MYMR"),"CHECK")))[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]K2[/TH]
[TD="align: left"]=IF(SUMPRODUCT(($A$2:$A$12=A2)*($B$2:$B$12=B2)*($F$2:$F$12=F2))=1,ROUND((E2-D2)/30,0),24)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]


Book1
HI
1Helper 1Helper 2
211
Sheet8
Cell Formulas
RangeFormula
H2=SUMPRODUCT(($B$2:$B$12=B2)*($A$2:$A$12=A2))
I2=SUMPRODUCT(--($A$2:$A$12=A2))
 
Last edited:
Upvote 0
Re: Extensive Excel Formula Help!

What if the data were to look like below? I added two new rows in red below:

[TABLE="width: 1300"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]Customer ID[/TD]
[TD]Service Type[/TD]
[TD]Contract ID[/TD]
[TD]Contract Start Date[/TD]
[TD]Contract End Date[/TD]
[TD]Contract Entered Date[/TD]
[TD]Contract Amount[/TD]
[TD]Type[/TD]
[TD]Revenue Month[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: right"]100[/TD]
[TD]Cleaning[/TD]
[TD="align: right"]35[/TD]
[TD="align: right"]1/1/2019[/TD]
[TD="align: right"]12/31/2019[/TD]
[TD="align: right"]12/15/2018[/TD]
[TD="align: right"]5,000.00[/TD]
[TD]SYSR[/TD]
[TD]12[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: right"]100[/TD]
[TD]Cleaning[/TD]
[TD="align: right"]35[/TD]
[TD="align: right"]1/1/2019[/TD]
[TD="align: right"]12/31/2019[/TD]
[TD="align: right"]1/31/2019[/TD]
[TD="align: right"]-1,000.00[/TD]
[TD]SYMR[/TD]
[TD]12[/TD]
[TD]discount given after the contract was signed due to service complaint[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="align: right"]100[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]35[/TD]
[TD="align: right"]3/1/2019[/TD]
[TD="align: right"]12/31/2019[/TD]
[TD="align: right"]12/15/2018[/TD]
[TD="align: right"]3,000.00[/TD]
[TD]SYMR[/TD]
[TD]10[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD="align: right"]582[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]79[/TD]
[TD="align: right"]4/1/2019[/TD]
[TD="align: right"]3/31/2020[/TD]
[TD="align: right"]2/15/2018[/TD]
[TD="align: right"]3,000.00[/TD]
[TD]MYSR[/TD]
[TD]24[/TD]
[TD]*24 because two contracts signed/entered at the same time[/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[TD="align: right"]582[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]80[/TD]
[TD="align: right"]4/1/2020[/TD]
[TD="align: right"]3/31/2021[/TD]
[TD="align: right"]2/15/2018[/TD]
[TD="align: right"]5,000.00[/TD]
[TD]MYSR[/TD]
[TD]24[/TD]
[TD]*24 because two contracts signed/entered at the same time[/TD]
[/TR]
[TR]
[TD="align: right"]7[/TD]
[TD="align: right"]582[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]85[/TD]
[TD="align: right"]4/1/2021[/TD]
[TD="align: right"]3/31/2022[/TD]
[TD="align: right"]3/10/2020[/TD]
[TD="align: right"]4,500.00[/TD]
[TD]SYSR[/TD]
[TD]12[/TD]
[TD]SYSR with 12 months because A NEW CONTRACT was ENTERED separate from the two that was signed and entered at the same time[/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[TD="align: right"]76[/TD]
[TD]Cleaning[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]1/31/2020[/TD]
[TD="align: right"]1/15/2019[/TD]
[TD="align: right"]3,000.00[/TD]
[TD]MYMR[/TD]
[TD]24[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[TD="align: right"]76[/TD]
[TD]Installation[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]1/31/2020[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]1,000.00[/TD]
[TD]MYMR[/TD]
[TD]24[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[TD="align: right"]76[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]1/31/2020[/TD]
[TD="align: right"]1/15/2019[/TD]
[TD="align: right"]3,000.00[/TD]
[TD]MYMR[/TD]
[TD]24[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[TD="align: right"]76[/TD]
[TD]Cleaning[/TD]
[TD="align: right"]254[/TD]
[TD="align: right"]2/1/2020[/TD]
[TD="align: right"]1/31/2021[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]2,500.00[/TD]
[TD]MYMR[/TD]
[TD]24[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[TD="align: right"]76[/TD]
[TD]Installation[/TD]
[TD="align: right"]254[/TD]
[TD="align: right"]2/1/2020[/TD]
[TD="align: right"]1/31/2021[/TD]
[TD="align: right"]1/15/2019[/TD]
[TD="align: right"]1,500.00[/TD]
[TD]MYMR[/TD]
[TD]24[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]13[/TD]
[TD="align: right"]76[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]254[/TD]
[TD="align: right"]2/1/2020[/TD]
[TD="align: right"]1/31/2021[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]3,750.00[/TD]
[TD]MYMR[/TD]
[TD]24[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Re: Extensive Excel Formula Help!

Aryatect
What if I were to have below additional scenarios in red?


[TABLE="class: cms_table_outer_border, width: 1310, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]Customer ID[/TD]
[TD]Service Type[/TD]
[TD]Contract ID[/TD]
[TD]Contract Start Date[/TD]
[TD]Contract End Date[/TD]
[TD]Contract Entered Date[/TD]
[TD]Contract Amount[/TD]
[TD]Type[/TD]
[TD]Revenue Month[/TD]
[TD]Note[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[TD]Cleaning[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1/1/2019[/TD]
[TD="align: right"]12/31/2019[/TD]
[TD="align: right"]12/15/2018[/TD]
[TD="align: right"]5,000.00[/TD]
[TD]SYSR[/TD]
[TD="align: right"]12[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: right"]100[/TD]
[TD]Cleaning[/TD]
[TD="align: right"]35[/TD]
[TD="align: right"]3/1/2019[/TD]
[TD="align: right"]12/31/2019[/TD]
[TD="align: right"]12/15/2018[/TD]
[TD="align: right"]2,000.00[/TD]
[TD]SYMR[/TD]
[TD="align: right"]10[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="align: right"]100[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]35[/TD]
[TD="align: right"]3/1/2019[/TD]
[TD="align: right"]12/31/2019[/TD]
[TD="align: right"]12/15/2018[/TD]
[TD="align: right"]3,000.00[/TD]
[TD]SYMR[/TD]
[TD="align: right"]10[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD="align: right"]100[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]35[/TD]
[TD="align: right"]3/1/2019[/TD]
[TD="align: right"]12/31/2019[/TD]
[TD="align: right"]3/15/2019[/TD]
[TD="align: right"](1,000.00)[/TD]
[TD]SYMR[/TD]
[TD="align: right"]10[/TD]
[TD]Discount given due to service complaint[/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[TD="align: right"]582[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]79[/TD]
[TD="align: right"]4/1/2019[/TD]
[TD="align: right"]3/31/2020[/TD]
[TD="align: right"]2/15/2018[/TD]
[TD="align: right"]3,000.00[/TD]
[TD]MYSR[/TD]
[TD="align: right"]24[/TD]
[TD]24 because two contracts signed/entered at the same time[/TD]
[/TR]
[TR]
[TD="align: right"]7[/TD]
[TD="align: right"]582[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]80[/TD]
[TD="align: right"]4/1/2020[/TD]
[TD="align: right"]3/31/2021[/TD]
[TD="align: right"]2/15/2018[/TD]
[TD="align: right"]5,000.00[/TD]
[TD]MYSR[/TD]
[TD="align: right"]24[/TD]
[TD]24 because two contracts signed/entered at the same time[/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[TD="align: right"]582[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]85[/TD]
[TD="align: right"]4/1/2021[/TD]
[TD="align: right"]3/31/2022[/TD]
[TD="align: right"]3/10/2020[/TD]
[TD="align: right"]4,500.00[/TD]
[TD]SYSR[/TD]
[TD="align: right"]12[/TD]
[TD]SYSR with 12 months because A NEW CONTRACT was ENTERED separate from the two that was signed and entered at the same time[/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[TD="align: right"]76[/TD]
[TD]Cleaning[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]1/31/2020[/TD]
[TD="align: right"]1/15/2019[/TD]
[TD="align: right"]3,000.00[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[TD="align: right"]76[/TD]
[TD]Installation[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]1/31/2020[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]1,000.00[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[TD="align: right"]76[/TD]
[TD]Installation[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]1/31/2020[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"](500.00)[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD]Discount given as there was a delayed installation timing[/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[TD="align: right"]76[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]1/31/2020[/TD]
[TD="align: right"]1/15/2019[/TD]
[TD="align: right"]3,000.00[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]13[/TD]
[TD="align: right"]76[/TD]
[TD]Cleaning[/TD]
[TD="align: right"]254[/TD]
[TD="align: right"]2/1/2020[/TD]
[TD="align: right"]1/31/2021[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]2,500.00[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]14[/TD]
[TD="align: right"]76[/TD]
[TD]Installation[/TD]
[TD="align: right"]254[/TD]
[TD="align: right"]2/1/2020[/TD]
[TD="align: right"]1/31/2021[/TD]
[TD="align: right"]1/15/2019[/TD]
[TD="align: right"]1,500.00[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]15[/TD]
[TD="align: right"]76[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]254[/TD]
[TD="align: right"]2/1/2020[/TD]
[TD="align: right"]1/31/2021[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]3,750.00[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
Re: Extensive Excel Formula Help!

Hi,

So somewhere the logic is not matching, I am posting your both updated tables and formula it used for both, I have 2 Revenue month in this having 2 different logic, can you evaluate the condition of this or can you more clearly define on what all columns and values each Type and Revenue month is dependent on.

Data with 2 red lines inserted:


Book1
ABCDEFGHIJKLMN
16Customer IDService TypeContract IDContract Start DateContract End DateContract Entered DateContract AmountHelper 1Helper 2TypeRevenue month 1Revenue month 2Expected TypeExpected Revenue Month
17100Cleaning351/1/201912/31/201912/15/2018500012SYMR1224SYSR12
18100Cleaning351/1/201912/31/20191/31/2019-100011SYSR1212SYMR12
19100Maintenance353/1/201912/31/201912/15/2018300012SYMR1024SYMR10
20582Maintenance794/1/20193/31/20202/15/2018300022MYSR2424MYSR24
21582Maintenance804/1/20203/31/20212/15/2018500022MYSR2424MYSR24
22582Maintenance854/1/20213/31/20223/10/2020450011SYSR1212SYSR12
2376Cleaning1232/1/20191/31/20201/15/2019300026MYMR1224MYMR24
2476Installation1232/1/20191/31/20202/1/2019100026MYMR1224MYMR24
2576Maintenance1232/1/20191/31/20201/15/2019300026MYMR1224MYMR24
2676Cleaning2542/1/20201/31/20212/1/2019250026MYMR1224MYMR24
2776Installation2542/1/20201/31/20211/15/2019150026MYMR1224MYMR24
2876Maintenance2542/1/20201/31/20212/1/2019375026MYMR1224MYMR24
Sheet8 (2)
Cell Formulas
RangeFormula
H17=SUMPRODUCT(($B$17:$B$28=B17)*($A$17:$A$28=A17)*(YEAR($F$17:$F$28)=YEAR(F17)))
I17=SUMPRODUCT(($A$17:$A$28=A17)*(YEAR($F$17:$F$28)=YEAR(F17)))
J17=IF(AND(H17=1,I17=1),"SYSR",IF(AND(H17=1,I17>1),"SYMR",IF(AND(H17>1,I17>1),IF(H17=I17,"MYSR","MYMR"),"CHECK")))
K17=IF(SUMPRODUCT(($A$17:$A$28=A17)*($F$17:$F$28=F17)*($B$17:$B$28=B17))=1,ROUND((E17-D17)/30,0),24)
L17=IF(SUMPRODUCT(($A$17:$A$28=A17)*($F$17:$F$28=F17))=1,ROUND((E17-D17)/30,0),24)


Data with 3 red entries inserted:


Book1
ABCDEFGHIJKLMN
32Customer IDService TypeContract IDContract Start DateContract End DateContract Entered DateContract AmountHelper 1Helper 2TypeRevenue month 1Revenue month 2Expected TypeExpected Revenue Month
331Cleaning21/1/201912/31/201912/15/2018500011SYSR1212SYSR12
34100Cleaning353/1/201912/31/201912/15/2018200012SYMR1024SYMR10
35100Maintenance353/1/201912/31/201912/15/2018300012SYMR1024SYMR10
36100Maintenance353/1/201912/31/20193/15/2019-100011SYSR1010SYMR10
37582Maintenance794/1/20193/31/20202/15/2018300022MYSR2424MYSR24
38582Maintenance804/1/20203/31/20212/15/2018500022MYSR2424MYSR24
39582Maintenance854/1/20213/31/20223/10/2020450011SYSR1212SYSR12
4076Cleaning1232/1/20191/31/20201/15/2019300027MYMR1224MYMR24
4176Installation1232/1/20191/31/20202/1/2019100037MYMR2424MYMR24
4276Installation1232/1/20191/31/20202/1/2019-50037MYMR2424MYMR24
4376Maintenance1232/1/20191/31/20201/15/2019300027MYMR1224MYMR24
4476Cleaning2542/1/20201/31/20212/1/2019250027MYMR1224MYMR24
4576Installation2542/1/20201/31/20211/15/2019150037MYMR1224MYMR24
4676Maintenance2542/1/20201/31/20212/1/2019375027MYMR1224MYMR24
Sheet8 (2)
Cell Formulas
RangeFormula
H33=SUMPRODUCT(($B$33:$B$46=B33)*($A$33:$A$46=A33)*(YEAR($F$33:$F$46)=YEAR(F33)))
I33=SUMPRODUCT(($A$33:$A$46=A33)*(YEAR($F$33:$F$46)=YEAR(F33)))
J33=IF(AND(H33=1,I33=1),"SYSR",IF(AND(H33=1,I33>1),"SYMR",IF(AND(H33>1,I33>1),IF(H33=I33,"MYSR","MYMR"),"CHECK")))
K33=IF(SUMPRODUCT(($A$33:$A$46=A33)*($F$33:$F$46=F33)*($B$33:$B$46=B33))=1,ROUND((E33-D33)/30,0),24)
L33=IF(SUMPRODUCT(($A$33:$A$46=A33)*($F$33:$F$46=F33))=1,ROUND((E33-D33)/30,0),24)
 
Upvote 0
Re: Extensive Excel Formula Help!

Hi Aryatect, Thank you for you help on this.

Please see below table with finalized data, my logic, and the result that I am looking for:

[TABLE="class: grid, width: 1632"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]M[/TD]
[TD]N[/TD]
[TD]O[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Customer ID[/TD]
[TD]Service Type[/TD]
[TD]Contract ID[/TD]
[TD]Contract Start Date[/TD]
[TD]Contract End Date[/TD]
[TD]Contract Entered Date[/TD]
[TD]Contract Amount[/TD]
[TD]Expected Type[/TD]
[TD]Expected Rev Month[/TD]
[TD]Note[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD="align: right"]1[/TD]
[TD]Cleaning[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1/1/2019[/TD]
[TD="align: right"]12/31/2019[/TD]
[TD="align: right"]12/15/2018[/TD]
[TD="align: right"]5000[/TD]
[TD]SYSR[/TD]
[TD="align: right"]12[/TD]
[TD]Customer with one contract with one service type for one year[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD="align: right"]100[/TD]
[TD]Cleaning[/TD]
[TD="align: right"]35[/TD]
[TD="align: right"]3/1/2019[/TD]
[TD="align: right"]12/31/2019[/TD]
[TD="align: right"]12/15/2018[/TD]
[TD="align: right"]2000[/TD]
[TD]SYMR[/TD]
[TD="align: right"]10[/TD]
[TD]Customer with one contract with multiple type for one year. Rev month 10 (3/2019 - 12/2019)[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD="align: right"]100[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]35[/TD]
[TD="align: right"]3/1/2019[/TD]
[TD="align: right"]12/31/2019[/TD]
[TD="align: right"]12/15/2018[/TD]
[TD="align: right"]3000[/TD]
[TD]SYMR[/TD]
[TD="align: right"]10[/TD]
[TD]Customer with one contract with multiple type for one year. Rev month 10 (3/2019 - 12/2019)[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD="align: right"]100[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]35[/TD]
[TD="align: right"]3/1/2019[/TD]
[TD="align: right"]12/31/2019[/TD]
[TD="align: right"]3/15/2019[/TD]
[TD="align: right"]-1000[/TD]
[TD]SYMR[/TD]
[TD="align: right"]10[/TD]
[TD]Customer with one contract with multiple type for one year. Rev month 10 (3/2019 - 12/2019)[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD="align: right"]582[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]79[/TD]
[TD="align: right"]4/1/2019[/TD]
[TD="align: right"]3/31/2020[/TD]
[TD="align: right"]2/15/2018[/TD]
[TD="align: right"]3000[/TD]
[TD]MYSR[/TD]
[TD="align: right"]24[/TD]
[TD]Customer with two contracts signed on the same date with one service type - 24 months (4/2019 - 3/2021)[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD="align: right"]582[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]80[/TD]
[TD="align: right"]4/1/2020[/TD]
[TD="align: right"]3/31/2021[/TD]
[TD="align: right"]2/15/2018[/TD]
[TD="align: right"]5000[/TD]
[TD]MYSR[/TD]
[TD="align: right"]24[/TD]
[TD]Customer with two contracts signed on the same date with one service type - 24 months (4/2019 - 3/2021)[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD="align: right"]582[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]85[/TD]
[TD="align: right"]4/1/2021[/TD]
[TD="align: right"]3/31/2022[/TD]
[TD="align: right"]3/10/2020[/TD]
[TD="align: right"]4500[/TD]
[TD]SYSR[/TD]
[TD="align: right"]12[/TD]
[TD]Same customer but with a new contract sign/entered date with one service - rev month 12 (4/2021 - 3/2022)[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD="align: right"]76[/TD]
[TD]Cleaning[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]1/31/2020[/TD]
[TD="align: right"]1/15/2019[/TD]
[TD="align: right"]3000[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD]Customer with multiple contract signed on the same date with multiple service - rev month 24 (2/2019 - 1/2021)[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD="align: right"]76[/TD]
[TD]Installation[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]1/31/2020[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]1000[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD]Customer with multiple contract signed on the same date with multiple service - rev month 24 (2/2019 - 1/2021)[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD="align: right"]76[/TD]
[TD]Installation[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]1/31/2020[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]-500[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD]Customer with multiple contract signed on the same date with multiple service - rev month 24 (2/2019 - 1/2021)[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD="align: right"]76[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]1/31/2020[/TD]
[TD="align: right"]1/15/2019[/TD]
[TD="align: right"]3000[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD]Customer with multiple contract signed on the same date with multiple service - rev month 24 (2/2019 - 1/2021)[/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD="align: right"]76[/TD]
[TD]Cleaning[/TD]
[TD="align: right"]254[/TD]
[TD="align: right"]2/1/2020[/TD]
[TD="align: right"]1/31/2021[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]2500[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD]Customer with multiple contract signed on the same date with multiple service - rev month 24 (2/2019 - 1/2021)[/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD="align: right"]76[/TD]
[TD]Installation[/TD]
[TD="align: right"]254[/TD]
[TD="align: right"]2/1/2020[/TD]
[TD="align: right"]1/31/2021[/TD]
[TD="align: right"]1/15/2019[/TD]
[TD="align: right"]1500[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD]Customer with multiple contract signed on the same date with multiple service - rev month 24 (2/2019 - 1/2021)[/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD="align: right"]76[/TD]
[TD]Maintenance[/TD]
[TD="align: right"]254[/TD]
[TD="align: right"]2/1/2020[/TD]
[TD="align: right"]1/31/2021[/TD]
[TD="align: right"]2/1/2019[/TD]
[TD="align: right"]3750[/TD]
[TD]MYMR[/TD]
[TD="align: right"]24[/TD]
[TD]Customer with multiple contract signed on the same date with multiple service - rev month 24 (2/2019 - 1/2021)[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Re: Extensive Excel Formula Help!

Thanks, give me some time, will try my best to to get back on this.
 
Upvote 0
Re: Extensive Excel Formula Help!

Hi jeongs1,

This should do the trick! Used a great trick from Mike "excelisfun" Girvin's video to calculate unique entries.


Book1
ABCDEFGHIJKL
1Customer IDService TypeContract IDContract Start DateContract End DateContract Entered DateContract AmountTypeRevenue MonthExpected TypeExpected Rev MonthNote
21Cleaning21/1/201912/31/201912/15/20185000SYSR12SYSR12Customer with one contract with one service type for one year
3100Cleaning353/1/201912/31/201912/15/20182000SYMR10SYMR10Customer with one contract with multiple type for one year. Rev month 10 (3/2019 - 12/2019)
4100Maintenance353/1/201912/31/201912/15/20183000SYMR10SYMR10Customer with one contract with multiple type for one year. Rev month 10 (3/2019 - 12/2019)
5100Maintenance353/1/201912/31/20193/15/2019-1000SYMR10SYMR10Customer with one contract with multiple type for one year. Rev month 10 (3/2019 - 12/2019)
6582Maintenance794/1/20193/31/20202/15/20183000MYSR24MYSR24Customer with two contracts signed on the same date with one service type - 24 months (4/2019 - 3/2021)
7582Maintenance804/1/20203/31/20212/15/20185000MYSR24MYSR24Customer with two contracts signed on the same date with one service type - 24 months (4/2019 - 3/2021)
8582Maintenance854/1/20213/31/20223/10/20204500SYSR12SYSR12Same customer but with a new contract sign/entered date with one service - rev month 12 (4/2021 - 3/2022)
976Cleaning1232/1/20191/31/20201/15/20193000MYMR24MYMR24Customer with multiple contract signed on the same date with multiple service - rev month 24 (2/2019 - 1/2021)
1076Installation1232/1/20191/31/20202/1/20191000MYMR24MYMR24Customer with multiple contract signed on the same date with multiple service - rev month 24 (2/2019 - 1/2021)
1176Installation1232/1/20191/31/20202/1/2019-500MYMR24MYMR24Customer with multiple contract signed on the same date with multiple service - rev month 24 (2/2019 - 1/2021)
1276Maintenance1232/1/20191/31/20201/15/20193000MYMR24MYMR24Customer with multiple contract signed on the same date with multiple service - rev month 24 (2/2019 - 1/2021)
1376Cleaning2542/1/20201/31/20212/1/20192500MYMR24MYMR24Customer with multiple contract signed on the same date with multiple service - rev month 24 (2/2019 - 1/2021)
1476Installation2542/1/20201/31/20211/15/20191500MYMR24MYMR24Customer with multiple contract signed on the same date with multiple service - rev month 24 (2/2019 - 1/2021)
1576Maintenance2542/1/20201/31/20212/1/20193750MYMR24MYMR24Customer with multiple contract signed on the same date with multiple service - rev month 24 (2/2019 - 1/2021)
Sheet2
Cell Formulas
RangeFormula
H2{=IF(SUM(IF(FREQUENCY(IF(($A$2:$A$15=A2)*($F$2:$F$15=F2),MATCH($C$2:$C$15,$C$2:$C$15,0)),ROW($A$2:$A$15)-ROW($A$1)),1))=1,"SY","MY")&IF(SUM(IF(FREQUENCY(IF($A$2:$A$15=A2,MATCH($B$2:$B$15,$B$2:$B$15,0)),ROW($A$2:$A$15)-ROW($A$1)),1))=1,"SR","MR")}
I2{=ROUND((AGGREGATE(14,6,IF(($A$2:$A$15=A2)*($B$2:$B$15=B2)*(YEAR($F$2:$F$15)=YEAR(F2)),$E$2:$E$15),1)-AGGREGATE(15,6,IF(($A$2:$A$15=A2)*($B$2:$B$15=B2)*(YEAR($F$2:$F$15)=YEAR(F2)),$D$2:$D$15),1))/30,0)}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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