ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Two conditions in one IF statement (https://www.excelbanter.com/excel-programming/357496-two-conditions-one-if-statement.html)

shashi1515[_12_]

Two conditions in one IF statement
 

Can I have two conditional statements in a IF statement.

Ex: if (condition A) or (condition B) then

do this

elseif (conditions c) and (condition D) then

do this

endif


How do I write in this syntax. Please let me know.

Thanks,
Shashi


--
shashi1515
------------------------------------------------------------------------
shashi1515's Profile: http://www.excelforum.com/member.php...o&userid=31109
View this thread: http://www.excelforum.com/showthread...hreadid=527776


lister_d_000169

Two conditions in one IF statement
 

you can use the or statement in your if

=IF(OR('Cell1'=1,'Cell2'=1),"True Case","False Case")

you can do a similar thing with the AND statement as well

hope this helps

rgds

mark


--
lister_d_000169
------------------------------------------------------------------------
lister_d_000169's Profile: http://www.excelforum.com/member.php...o&userid=32950
View this thread: http://www.excelforum.com/showthread...hreadid=527776


Don Guillett

Two conditions in one IF statement
 
Sure
if range("a1")=1 or range("b1")=2 then
do this
elseif
if range("c1")=3 and range("d1")=4
do that
end if

--
Don Guillett
SalesAid Software

"shashi1515" wrote
in message ...

Can I have two conditional statements in a IF statement.

Ex: if (condition A) or (condition B) then

do this

elseif (conditions c) and (condition D) then

do this

endif


How do I write in this syntax. Please let me know.

Thanks,
Shashi


--
shashi1515
------------------------------------------------------------------------
shashi1515's Profile:
http://www.excelforum.com/member.php...o&userid=31109
View this thread: http://www.excelforum.com/showthread...hreadid=527776





All times are GMT +1. The time now is 01:17 AM.

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