Formula: Indicate instances where a particular transaction type occurs after a different transaction type

kreestar

New Member
Joined
Apr 6, 2004
Messages
32
Hello,

Been scratching my head with this one this morning and hope - true to form - you have the answer.

Dummy data (sorted by Purchase Date/Time):

<b>Excel 2007</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th><th>G</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style="font-weight: bold;color: #FFFFFF;background-color: #1F497D;;">Customer Name</td><td style="font-weight: bold;color: #FFFFFF;background-color: #1F497D;;">First Name</td><td style="font-weight: bold;color: #FFFFFF;background-color: #1F497D;;">Last Name</td><td style="font-weight: bold;color: #FFFFFF;background-color: #1F497D;;">Purchase Date</td><td style="font-weight: bold;color: #FFFFFF;background-color: #1F497D;;">Amount</td><td style="font-weight: bold;color: #FFFFFF;background-color: #1F497D;;">Item</td><td style="font-weight: bold;color: #FFFFFF;background-color: #1F497D;;">TYPE</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style="background-color: #D7E4BC;;">Customer F</td><td style="background-color: #D7E4BC;;">Roger</td><td style="background-color: #D7E4BC;;">Jones</td><td style="text-align: right;background-color: #D7E4BC;;">5/30/2012 16:58</td><td style="text-align: right;background-color: #D7E4BC;;">11</td><td style="background-color: #D7E4BC;;">BBBB</td><td style="background-color: #D7E4BC;;">Cash Purchase</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style="background-color: #D7E4BC;;">Customer F</td><td style="background-color: #D7E4BC;;">Roger</td><td style="background-color: #D7E4BC;;">Jones</td><td style="text-align: right;background-color: #D7E4BC;;">6/2/2012 21:03</td><td style="text-align: right;background-color: #D7E4BC;;">11</td><td style="background-color: #D7E4BC;;">BBBB</td><td style="background-color: #D7E4BC;;">Cash Purchase</td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style="background-color: #D7E4BC;;">Customer F</td><td style="background-color: #D7E4BC;;">Roger</td><td style="background-color: #D7E4BC;;">Jones</td><td style="text-align: right;background-color: #D7E4BC;;">6/3/2012 17:13</td><td style="text-align: right;background-color: #D7E4BC;;">10</td><td style="background-color: #D7E4BC;;">CCCC</td><td style="background-color: #D7E4BC;;">Cash Purchase</td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style="background-color: #D7E4BC;;">Customer F</td><td style="background-color: #D7E4BC;;">Roger</td><td style="background-color: #D7E4BC;;">Jones</td><td style="text-align: right;background-color: #D7E4BC;;">6/4/2012 18:17</td><td style="text-align: right;background-color: #D7E4BC;;">10</td><td style="background-color: #D7E4BC;;">DDDD</td><td style="background-color: #D7E4BC;;">Cash Purchase</td></tr><tr ><td style="color: #161120;text-align: center;">6</td><td style="background-color: #D7E4BC;;">Customer F</td><td style="background-color: #D7E4BC;;">Roger</td><td style="background-color: #D7E4BC;;">Jones</td><td style="text-align: right;background-color: #D7E4BC;;">6/5/2012 19:18</td><td style="text-align: right;background-color: #D7E4BC;;">11</td><td style="background-color: #D7E4BC;;">EEEE</td><td style="background-color: #D7E4BC;;">Cash Purchase</td></tr><tr ><td style="color: #161120;text-align: center;">7</td><td style="background-color: #D7E4BC;;">Customer F</td><td style="background-color: #D7E4BC;;">Roger</td><td style="background-color: #D7E4BC;;">Jones</td><td style="text-align: right;background-color: #D7E4BC;;">6/6/2012 19:01</td><td style="text-align: right;background-color: #D7E4BC;;">10</td><td style="background-color: #D7E4BC;;">BBBB</td><td style="background-color: #D7E4BC;;">Cash Purchase</td></tr><tr ><td style="color: #161120;text-align: center;">8</td><td style="background-color: #FCD5B4;;">Customer F</td><td style="background-color: #FCD5B4;;">Roger</td><td style="background-color: #FCD5B4;;">Jones</td><td style="text-align: right;background-color: #FCD5B4;;">6/6/2012 22:10</td><td style="text-align: right;background-color: #FCD5B4;;">355</td><td style="background-color: #FCD5B4;;">BBBB</td><td style="background-color: #FCD5B4;;">Voucher Purchase</td></tr><tr ><td style="color: #161120;text-align: center;">9</td><td style="background-color: #FCD5B4;;">Customer A</td><td style="background-color: #FCD5B4;;">Bob</td><td style="background-color: #FCD5B4;;">Smith</td><td style="text-align: right;background-color: #FCD5B4;;">6/1/2012 22:54</td><td style="text-align: right;background-color: #FCD5B4;;">20</td><td style="background-color: #FCD5B4;;">AAAA</td><td style="background-color: #FCD5B4;;">Voucher Purchase</td></tr><tr ><td style="color: #161120;text-align: center;">10</td><td style="background-color: #D7E4BC;;">Customer A</td><td style="background-color: #D7E4BC;;">Bob</td><td style="background-color: #D7E4BC;;">Smith</td><td style="text-align: right;background-color: #D7E4BC;;">6/1/2012 22:56</td><td style="text-align: right;background-color: #D7E4BC;;">30</td><td style="background-color: #D7E4BC;;">BBBB</td><td style="background-color: #D7E4BC;;">Cash Purchase</td></tr><tr ><td style="color: #161120;text-align: center;">11</td><td style="background-color: #D7E4BC;;">Customer C</td><td style="background-color: #D7E4BC;;">John</td><td style="background-color: #D7E4BC;;">Williams</td><td style="text-align: right;background-color: #D7E4BC;;">5/31/2012 9:08</td><td style="text-align: right;background-color: #D7E4BC;;">30</td><td style="background-color: #D7E4BC;;">EEEE</td><td style="background-color: #D7E4BC;;">Cash Purchase</td></tr><tr ><td style="color: #161120;text-align: center;">12</td><td style="background-color: #FCD5B4;;">Customer C</td><td style="background-color: #FCD5B4;;">John</td><td style="background-color: #FCD5B4;;">Williams</td><td style="text-align: right;background-color: #FCD5B4;;">6/2/2012 15:57</td><td style="text-align: right;background-color: #FCD5B4;;">400</td><td style="background-color: #FCD5B4;;">DDDD</td><td style="background-color: #FCD5B4;;">Voucher Purchase</td></tr><tr ><td style="color: #161120;text-align: center;">13</td><td style="background-color: #D7E4BC;;">Customer C</td><td style="background-color: #D7E4BC;;">John</td><td style="background-color: #D7E4BC;;">Williams</td><td style="text-align: right;background-color: #D7E4BC;;">6/5/2012 3:46</td><td style="text-align: right;background-color: #D7E4BC;;">30</td><td style="background-color: #D7E4BC;;">EEEE</td><td style="background-color: #D7E4BC;;">Cash Purchase</td></tr><tr ><td style="color: #161120;text-align: center;">14</td><td style="background-color: #FCD5B4;;">Customer C</td><td style="background-color: #FCD5B4;;">John</td><td style="background-color: #FCD5B4;;">Williams</td><td style="text-align: right;background-color: #FCD5B4;;">6/4/2012 22:33</td><td style="text-align: right;background-color: #FCD5B4;;">50</td><td style="background-color: #FCD5B4;;">DDDD</td><td style="background-color: #FCD5B4;;">Voucher Purchase</td></tr><tr ><td style="color: #161120;text-align: center;">15</td><td style="background-color: #FCD5B4;;">Customer C</td><td style="background-color: #FCD5B4;;">John</td><td style="background-color: #FCD5B4;;">Williams</td><td style="text-align: right;background-color: #FCD5B4;;">6/5/2012 22:18</td><td style="text-align: right;background-color: #FCD5B4;;">800</td><td style="background-color: #FCD5B4;;">DDDD</td><td style="background-color: #FCD5B4;;">Voucher Purchase</td></tr><tr ><td style="color: #161120;text-align: center;">16</td><td style="background-color: #D7E4BC;;">Customer D</td><td style="background-color: #D7E4BC;;">Lily</td><td style="background-color: #D7E4BC;;">Edwards</td><td style="text-align: right;background-color: #D7E4BC;;">6/5/2012 3:46</td><td style="text-align: right;background-color: #D7E4BC;;">30</td><td style="background-color: #D7E4BC;;">DDDD</td><td style="background-color: #D7E4BC;;">Cash Purchase</td></tr><tr ><td style="color: #161120;text-align: center;">17</td><td style="background-color: #FCD5B4;;">Customer D</td><td style="background-color: #FCD5B4;;">Lily</td><td style="background-color: #FCD5B4;;">Edwards</td><td style="text-align: right;background-color: #FCD5B4;;">6/6/2012 1:41</td><td style="text-align: right;background-color: #FCD5B4;;">500</td><td style="background-color: #FCD5B4;;">BBBB</td><td style="background-color: #FCD5B4;;">Voucher Purchase</td></tr><tr ><td style="color: #161120;text-align: center;">18</td><td style="background-color: #D7E4BC;;">Customer D</td><td style="background-color: #D7E4BC;;">Lily</td><td style="background-color: #D7E4BC;;">Edwards</td><td style="text-align: right;background-color: #D7E4BC;;">6/7/2012 7:06</td><td style="text-align: right;background-color: #D7E4BC;;">100</td><td style="background-color: #D7E4BC;;">BBBB</td><td style="background-color: #D7E4BC;;">Cash Purchase</td></tr><tr ><td style="color: #161120;text-align: center;">19</td><td style="background-color: #D7E4BC;;">Customer D</td><td style="background-color: #D7E4BC;;">Lily</td><td style="background-color: #D7E4BC;;">Edwards</td><td style="text-align: right;background-color: #D7E4BC;;">6/7/2012 8:05</td><td style="text-align: right;background-color: #D7E4BC;;">100</td><td style="background-color: #D7E4BC;;">EEEE</td><td style="background-color: #D7E4BC;;">Cash Purchase</td></tr><tr ><td style="color: #161120;text-align: center;">20</td><td style="background-color: #D7E4BC;;">Customer G</td><td style="background-color: #D7E4BC;;">Cathy</td><td style="background-color: #D7E4BC;;">Brown</td><td style="text-align: right;background-color: #D7E4BC;;">6/5/2012 11:04</td><td style="text-align: right;background-color: #D7E4BC;;">20</td><td style="background-color: #D7E4BC;;">BBBB</td><td style="background-color: #D7E4BC;;">Cash Purchase</td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #A6AAB6;border-top:none;text-align: center;background-color: #E0E0F0;color: #161120">Sheet1</p>

We're needing to isolate purchases that occur after a voucher has been used. We'll add "Transaction" column ("Before Voucher"/"After Voucher"/"Voucher") and delete the "Before Voucher" items.

In the data above, Row 10 and Rows 18-19 are Transactions that happened after a Voucher Purchase. Rows 2-7 are not.

For customer Lily Edwards, we're not interested in seeing Row 16 (before Voucher Purchase), but do care about Row 18 and 19 (and 17 because it has the voucher purchase). We're not interested in seeing customers where there are no Voucher Purchases (e.g. Cathy Brown).

If there are multiple Voucher Purchases (like John Williams), we're interested in all Transaction occurring after a Voucher has been purchased, so we'd not care for Row 11, but we do for Rows 12-15 (Purchases after the first Voucher purchase, including the Voucher purchases themselves).

All my (feeble) attempts have ended in frustration, so hoping you guys can help!

Thanks,

Kree
 

Some videos you may like

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Watch MrExcel Video

Forum statistics

Threads
1,123,514
Messages
5,602,093
Members
414,501
Latest member
mdhaumyu

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
Top