IF Formula

refpj2000

New Member
Joined
Jun 22, 2008
Messages
4
Excel 2007
Windows Vista
If number in cell A1= 1 and cell A2= 1,
if A1 is greater than A2, return, 3
if A1=A2 and is 1 or greater, return, 2
if A1=A2 and is less than, return, 1
if not return, 0
therefore value in a3 should be two
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
If Number in A1=2 A2= 1
therefore value in a3 should be 3
If Number in A1=0 A2= 0
therefore value in a3 should be 1
If Number in A1=1 A2= 2
therefore value in a3 should be 0

Using =if(ISBLANK(a1),0,IF(a1>a2,3,IF(a1,1,0)))
but can't workout how to add if A1=A2 and is 1 or greater, return, 2
Any help greatly appreciated.

Thanks

Pat
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
Hello Pat, welcome to MrExcel

Try this formula

=IF(COUNT(A1:A2)=2,IF(A1>A2,3,IF(A1=A2,IF(A1>=1,2,1))))+0
 
Upvote 0

refpj2000

New Member
Joined
Jun 22, 2008
Messages
4
Thanks Barry for your quick response.

Tried the formula result was 0, as opposed 2.

Many thanks again

Pat
 
Upvote 0

refpj2000

New Member
Joined
Jun 22, 2008
Messages
4
Barry,

Sorry, worked a treat, my typo mistake.

More haste less speed on my part!

Many thanks

Pat
 
Upvote 0

Forum statistics

Threads
1,191,555
Messages
5,987,257
Members
440,086
Latest member
Mahi786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top