If 'Car Inventory #' is identical, always take take the second row in [Bought for / Resale price] minus the first row in [Bought for / Resale price] to get the markup amount, then multiply by the sales tax rate to get the tax owed to government. What formula could I use to solve the situation? Thanks.
| Car Inventory # | Status | Transaction | Bought for / Resale price | Sales Tax 7% |
| 123456 | In stock | Inventory bought | 6000 | |
| 123456 | Available for resale | Priced for resale | 8000 | |
| 234567 | In stock | Inventory bought | 500 | |
| 234567 | Available for resale | Priced for resale | 800 | |
| 345678 | In stock | Inventory bought | 2000 | |
| 345678 | Available for resale | Priced for resale | 3500 | |
| 456789 | In stock | Inventory bought | 8000 | |
| 456789 | Available for resale | Priced for resale | 12000 | |
| 567890 | In stock | Inventory bought | 5000 | |
| 567890 | Available for resale | Priced for resale | 6800 | |