Thread: excel formulas
View Single Post
  #12   Report Post  
Dana DeLouis
 
Posts: n/a
Default

IF A1 + A2 = 19 THEN B2 = 1
( A1 and A2 must have a value between 1 and 9 otherwise ERROR!)


Just an observation. If the max value of A1 or A2 is 9, then the sum will
never equal 19 (max would be 18). Is your question set correctly?

Seems like a form of Mod would work:
=MOD(A1+B1-1,9)+1

--
Dana DeLouis
Win XP & Office 2003


"Tomas" wrote in message
...
Bernie,
thanks a lot, this was helpful but I noticed I need to ask the right
question in order to get the right answer. So here it is what I want to
get:
A1 + A2 = B2
IF A1 + A2 = 2 THEN B2 = 2
IF A1 + A2 = 3 THEN B2 = 3
and so on
IF A1 + A2 = 9 THEN B2 = 9
IF A1 + A2 = 10 THEN B2 = 1
IF A1 + A2 = 11 THEN B2 = 2
IF A1 + A2 = 12 THEN B2 = 3
IF A1 + A2 = 13 THEN B2 = 4
IF A1 + A2 = 14 THEN B2 = 5
IF A1 + A2 = 15 THEN B2 = 6
IF A1 + A2 = 16 THEN B2 = 7
IF A1 + A2 = 17 THEN B2 = 8
IF A1 + A2 = 18 THEN B2 = 9
IF A1 + A2 = 19 THEN B2 = 1
( A1 and A2 must have a value between 1 and 9 otherwise ERROR!)

Thank you VERY much!!!
Tomas

"Bernie Deitrick" wrote:

Tomas,

If A is cell A1, and B is in cell B1, then in cell D1, use the formula

=IF((A1+B1)9,MOD(A1+B1,9)+ IF(MOD(A1+B1,9)=0,10,0),"")

Not sure if your pattern is meant to continue on indefinitely....

HTH,
Bernie
MS Excel MVP


"Tomas" wrote in message
...
How would I do the following:
A+B = C,
if C = 10 then D = 1
if C = 11 then D = 2
C = 12 then D = 3
and so on
C = 19 then D = 1
thank you!
__________________________________________________ _______________