I'd follow one of two approaches. 1) macro/vba programming 2)VLookups and add some extra data to your sheet.

The macro would:

1) Loop through the rows in the 'Slab End' column to find the 'slab' number that User Count fits in by locating where Slab Start > User count.

In your example this would be the slab 21 - 200.

2) Work out the amount for the 'slab steps' (if that makes sense), by multiplying the Slab Width for every slab lower than the slab found in step 1) and adding the results

In your example this would be (10 * 0.80) + (10 * 1.00)

3) Subtract the widths from the User Count to find the number that are left for the slab found in step 1).

In your example this would be 60 - 20 = 40 * 0.5.

However, I think adding some extra data to your sheet and using VLookup would work without resorting to macros. I would add columns of 'CountLessThanSlab' and 'CostOfCount' to each row resulting in a sheet that looks like:

```
Start End Width CountLessThan CostLessThan SlabUnit
1 10 10 1.00
11 20 10 10 10.00 0.80
21 200 180 20 18.00 0.50
201 500 300 200 108.00 0.30
```

Then your formula would take the User count (60), use VLookup to find the correct row (21, 200, 180, ...), subtract 'CountLessThan' (20) from User count to get 40, and add the sum of that figure multiplied by the Slab Unit cost to the AmountLessThan in the same row. Something like this should do it:

`=vlookup(B1, $B$3:$E$7, 4, true) + ((B1 - vlookup(B1, $B$3:$E$7, 3, true)) * vlookup(B1, $B$3:$E$7, 5, true))`

Caveat: I don't have excel in front of me, atm.

**Edit**: I'm a drongo

The concept is valid, but the formula is wrong. (I incorrectly remembered the looked up value being less than the relevant value in the table, but it's the other way around.)

This formula works, using the table setup I mentioned above:

```
=VLOOKUP(B1, $A$3:$F$7, 5, TRUE) + ((B1 - VLOOKUP(B1, $A$3:$F$7, 4, TRUE)) * VLOOKUP(B1, $A$3:$F$7, 6, TRUE))
```

Users in slabis(the maximum of (the minimum of. No Excel available right now, but this should be easy. Screenshot of the spreadsheet in Apple Numbers. From`User count - Slab Start + 1`

and`slab width`

) and`0`

)Users in slab, you getSlab Cost, sum these up and you're done. Note that the last slab has end and width only to allow me to use the same formula. – Daniel Beck♦ May 1 '13 at 9:53