ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   IF/AND formulas within excel (https://www.excelbanter.com/excel-discussion-misc-queries/2974-if-formulas-within-excel.html)

mark.ew

IF/AND formulas within excel
 
Hi there,
Could anybody please help me with a formula i am trying to enter into my
excel spreadsheet.
i have two sets of variables "a" and "b" which are related to each other.
Using a seperate formula I obtain "c" What i would like to do is apply 1 of
4 equations to "c" depending on the value of "a" and "b".

if "a"0 and "b"0 then "c" stays as it is
"a"<0 and "b"0 then minus"c" from 360
"a"0 and "b"<0 then minus"c" from 180
"a"<0 and "b"<0 then "c" plus 180

Is it at all possible to formulate the above??

Thanks for any help


Mark

Don Guillett

I suggest changing your variable names to va, vb,vc and then nesting the
if's

--
Don Guillett
SalesAid Software

"mark.ew" wrote in message
...
Hi there,
Could anybody please help me with a formula i am trying to enter into my
excel spreadsheet.
i have two sets of variables "a" and "b" which are related to each other.
Using a seperate formula I obtain "c" What i would like to do is apply 1

of
4 equations to "c" depending on the value of "a" and "b".

if "a"0 and "b"0 then "c" stays as it is
"a"<0 and "b"0 then minus"c" from 360
"a"0 and "b"<0 then minus"c" from 180
"a"<0 and "b"<0 then "c" plus 180

Is it at all possible to formulate the above??

Thanks for any help


Mark




cwilson

Hi mark,

See if this works:

A1 B1 C1
# # #

In D1 type
=IF(AND(A10,B10),C1,IF(AND(A1<0,B10),360-C1,IF(AND(A10,B1<0),180-C1,IF(AND(A1<0,B1<0),180+C1,"ERROR"))))

it worked for me.

HTH

cwilson



"mark.ew" wrote:

Hi there,
Could anybody please help me with a formula i am trying to enter into my
excel spreadsheet.
i have two sets of variables "a" and "b" which are related to each other.
Using a seperate formula I obtain "c" What i would like to do is apply 1 of
4 equations to "c" depending on the value of "a" and "b".

if "a"0 and "b"0 then "c" stays as it is
"a"<0 and "b"0 then minus"c" from 360
"a"0 and "b"<0 then minus"c" from 180
"a"<0 and "b"<0 then "c" plus 180

Is it at all possible to formulate the above??

Thanks for any help


Mark


mark.ew

"a" "b" "c" are indicative only. I have true numerical values for them. What
i would like to do is enter a formula, that would have excel analyse cells
"va" and "vb" and then depending on the permutations of "va" and "vb" being
positive or negative, apply one of the equations. I have a couple hundred
sets of "va" and "vb" cells, so it would save alot of time, if it was
possible to enter a formula, rather than manually checking each set.
Is it possible to input one formula that contains all four equations below,
but that would only apply the correct one based on positives and negatives of
"va" and "vb"

"Don Guillett" wrote:

I suggest changing your variable names to va, vb,vc and then nesting the
if's

--
Don Guillett
SalesAid Software

"mark.ew" wrote in message
...
Hi there,
Could anybody please help me with a formula i am trying to enter into my
excel spreadsheet.
i have two sets of variables "a" and "b" which are related to each other.
Using a seperate formula I obtain "c" What i would like to do is apply 1

of
4 equations to "c" depending on the value of "a" and "b".

if "a"0 and "b"0 then "c" stays as it is
"a"<0 and "b"0 then minus"c" from 360
"a"0 and "b"<0 then minus"c" from 180
"a"<0 and "b"<0 then "c" plus 180

Is it at all possible to formulate the above??

Thanks for any help


Mark





JE McGimpsey

First, what happens if "a"=0 or "b" = 0 ????

One way:

=IF(OR(a=0,b=0),"????",IF(a0,IF(b0,c,180-c),IF(b0,360-c,c+180)))


In article ,
"mark.ew" wrote:

Hi there,
Could anybody please help me with a formula i am trying to enter into my
excel spreadsheet.
i have two sets of variables "a" and "b" which are related to each other.
Using a seperate formula I obtain "c" What i would like to do is apply 1 of
4 equations to "c" depending on the value of "a" and "b".

if "a"0 and "b"0 then "c" stays as it is
"a"<0 and "b"0 then minus"c" from 360
"a"0 and "b"<0 then minus"c" from 180
"a"<0 and "b"<0 then "c" plus 180

Is it at all possible to formulate the above??

Thanks for any help


Mark


Dana DeLouis

Just another option:

=CHOOSE(2*(a0)+(b0)+1,c+180,360-c,180-c,c)

However, if a,b, & c are angles, then there may be a more simplified
solution.

--
Dana DeLouis
Win XP & Office 2003


"mark.ew" wrote in message
...
Hi there,
Could anybody please help me with a formula i am trying to enter into my
excel spreadsheet.
i have two sets of variables "a" and "b" which are related to each other.
Using a seperate formula I obtain "c" What i would like to do is apply 1
of
4 equations to "c" depending on the value of "a" and "b".

if "a"0 and "b"0 then "c" stays as it is
"a"<0 and "b"0 then minus"c" from 360
"a"0 and "b"<0 then minus"c" from 180
"a"<0 and "b"<0 then "c" plus 180

Is it at all possible to formulate the above??

Thanks for any help


Mark





All times are GMT +1. The time now is 02:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com