Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Greetings-
I am trying to subtract x-i. Both variables have values between 1-26. I want for the result to always be positive; i.e. if i is bigger than x, then the difference to be subtracted from 26. For example x=3, i=10 x-i=19. Can I do this with the formulas or should I write a vb script? I am new to vb, any help is greatly appreciated. Sean |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Friday, November 23, 2012 2:02:23 PM UTC-8, wrote:
Greetings- I am trying to subtract x-i. Both variables have values between 1-26. I want for the result to always be positive; i.e. if i is bigger than x, then the difference to be subtracted from 26. For example x=3, i=10 x-i=19.. Can I do this with the formulas or should I write a vb script? I am new to vb, any help is greatly appreciated. Sean Hi Sean, I think this does what you want, if I understand correctly. Where your x value is in column C & your i value is in column D. The second formula is with 26 in cell B1. =IF(C2D2,26-(C2-D2),D2-C2) =IF(C2D2,B1-(C2-D2),D2-C2) HTH Regards, Howard |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Implement time-out | Excel Programming | |||
How best to integrate/implement this? | Excel Programming | |||
WNetGetUniversalName - how to implement in VBA? | Excel Programming | |||
Reference range of cells and perform subtraction or nothing depending on contents | Excel Worksheet Functions | |||
How to implement an iRtdServer? | Excel Programming |