# Complex Offset formula

#### Matt_Thompson

##### Board Regular
Hi,

I hope someone can help or at least put me in the right direction.

I have 3 offset formula's which I need to combine. This in itself shouldn't be a problem (I don't think!) but to make this a bit more complex, I have been told that the result of the offsets need to be capped at 20%+/-.

The 3 offsets are:
=SUM(I10:OFFSET(I10,0,\$BQ\$1-2))/SUM(I2:OFFSET(I2,0,\$BQ\$1-2))
divided by
=SUM(U10:OFFSET(U10,0,\$BQ\$1-2))/SUM(U2:OFFSET(U2,0,\$BQ\$1-2))
multiply
=OFFSET(I10,0,\$BQ\$1-1)

In the offsets I10 is this years monthly figures and \$BQ\$1 is the offset that is showing the current period.
I2 is the number of calendar days for that month.
U10 is last years monthly figures and the last offset is showing what the current Period figure is.

If I put all 3 formulae together, how would I then cap the outcome at between +20% and -20%?

Matt

### Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

#### Matt_Thompson

##### Board Regular
I've managed to do the formula so here it is for anyone who might find this useful:

=IF(SUM(SUM(I10:OFFSET(I10,0,\$BQ\$1-2))/SUM(I2:OFFSET(I2,0,\$BQ\$1-2))/SUM(U10:OFFSET(U10,0,\$BQ\$1-2))/SUM(U2:OFFSET(U2,0,\$BQ\$1-2))*SUM(OFFSET(I10,0,\$BQ\$1-1))/100)>20,20,AND(IF(SUM(SUM(I10:OFFSET(I10,0,\$BQ\$1-2))/SUM(I2:OFFSET(I2,0,\$BQ\$1-2))/SUM(U10:OFFSET(U10,0,\$BQ\$1-2))/SUM(U2:OFFSET(U2,0,\$BQ\$1-2))*SUM(OFFSET(I10,0,\$BQ\$1-1))/100)>-20,-20,(SUM(SUM(I10:OFFSET(I10,0,\$BQ\$1-2))/SUM(I2:OFFSET(I2,0,\$BQ\$1-2))/SUM(U10:OFFSET(U10,0,\$BQ\$1-2))/SUM(U2:OFFSET(U2,0,\$BQ\$1-2))*SUM(OFFSET(I10,0,\$BQ\$1-1))/100)))))

Where RED is saying if the offset formulae is greater than 20 put 20
BLUE is the same as above but for -20
Green is the else past of the if statement ie, if the first two criteria are false then follow this formula.

It's pretty crude and I'm sure it can be done much better than this but if this helps then feel free to use it or if anyone wants to know any more about this then PM me or mail me.

Thanks,

Matt

#### Domenic

##### MrExcel MVP
Try...

=MEDIAN(-0.2,YourFormulaHere,0.2)

Hope this helps!

#### Matt_Thompson

##### Board Regular
Hi Dominic,

I tried that but it doesn't work. This is the formula I put into excel:

=MEDIAN(-0.2,(SUM(SUM(I10:OFFSET(I10,0,\$BQ\$1-2))/SUM(I2:OFFSET(I2,0,\$BQ\$1-2))/SUM(U10:OFFSET(U10,0,\$BQ\$1-2))/SUM(U2:OFFSET(U2,0,\$BQ\$1-2))*SUM(OFFSET(I10,0,\$BQ\$1-1))/100),0.2)

Am I doing something wrong?

Thanks,

Matt

#### Matt_Thompson

##### Board Regular
Apologies Dominic,

I have got it working now. Sorry!

Here is the formula:

=MEDIAN(-0.2,(SUM(I10:OFFSET(I10,0,\$BQ\$1-2))/SUM(I2:OFFSET(I2,0,\$BQ\$1-2))/SUM(U10:OFFSET(U10,0,\$BQ\$1-2))/SUM(U2:OFFSET(U2,0,\$BQ\$1-2))*SUM(OFFSET(I10,0,\$BQ\$1-1))/100),0.2)*100

Matt

Replies
11
Views
204
Replies
2
Views
96
Replies
1
Views
28
Replies
12
Views
109
Replies
4
Views
63