Brad
Brad

Reputation: 1480

Excel IF statement to check 2 cells at once

I am trying to create an Excel formula which creates a range. This formula checks to make sure MOI_Range<>"NONE" and that USE_90 = "YES". The range values will also be kept above 0 and below 100.

Here is a VBA code example to help you get a better understanding.

IF MOI_Range <> "NONE" AND USE_90 = "YES" Then

Moi_Range

Else

CONCATENATE(IF(M15<0,0,M15), "-",IF(N15>100,100,N15), "%")

EndIf

Here is the formula that I attempted that gives an "There's a problem with this formula" message.

IF(MOI_Range<>"NONE" AND USE_90="YES",MOI_Range,CONCATENATE(IF(M15<0,0,M15), "-",IF(N15>100,100,N15), "%"))

Upvotes: 0

Views: 66

Answers (1)

Scott Craner
Scott Craner

Reputation: 152495

AND() is not done in line:

AND(MOI_Range<>"NONE", USE_90="YES")

So:

IF(AND(MOI_Range<>"NONE", USE_90="YES"),MOI_Range,CONCATENATE(IF(M15<0,0,M15), "-",IF(N15>100,100,N15), "%"))

Upvotes: 1

Related Questions