Which is the correct syntax to use in this example formula?

Event2020

Board Regular
Joined
Jan 6, 2011
Messages
122
Office Version
  1. 2019
Platform
  1. Windows
Hi I am still learning Excel and I am very grateful to the good folk on here who generously give their time to answer all of our questions - Thank you. I am writing a simple If formula that looks at cell B1 and if B1 contain the number 1 the formula does one thing but if it contains a different number it does something else. If it contains no number then it does nothing. My question is which is the correct syntax to use in terms of wring good formulas?
Code:
=IF(Add_CD_Information!$B$4>1,"Do This","Do That")
or
Code:
=IF(Add_CD_Information!$B$4=1,"Do This","Do That")
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Neither of those take into account the option of doing nothing if B4 doesn't contain a number. I'd suggest a structure something like:

=IF(ISNUMBER(Add_CD_Information!$B$4),IF(Add_CD_Information!$B$4=1,"Do This","Do That"),"")

where "" is the "do nothing" option.
 
Upvote 0
Those formulae do totally different things.

In the second formula you will get "Do This" ONLY if B4 contains 1
Whereas with the first formula you will get "Do This" if B4 has any number GREATER than 1, OR contains text.
 
Upvote 0
Neither of those take into account the option of doing nothing if B4 doesn't contain a number. I'd suggest a structure something like:

=IF(ISNUMBER(Add_CD_Information!$B$4),IF(Add_CD_Information!$B$4=1,"Do This","Do That"),"")

where "" is the "do nothing" option.


Hi Rory

Yes you are correct, that was an omission on my part :P
 
Upvote 0
Those formulae do totally different things.

In the second formula you will get "Do This" ONLY if B4 contains 1
Whereas with the first formula you will get "Do This" if B4 has any number GREATER than 1, OR contains text.

Hi Fluff

Many thanks :)
 
Upvote 0
This is what I love about this Forum

I learnt two very useful things with one question!

Thanks guys :)
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,721
Messages
6,174,096
Members
452,542
Latest member
Bricklin

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
Back
Top