SOLVED

Multiple IF function

Brass Contributor

I am trying to apply appropriate commissions based on finding "CR" in a column.

 

So far, I have: =SUM((ISNUMBER(SEARCH("CR",D3))*(I3*0.65))) - which if it finds CR in field D3, it multiples field I3 by .65. 

 

I need it to then determine that if CR is not found, to multiply field I3 by 1.

 

Is that possible?

17 Replies

Hi Katie,

 

Perhaps something like

=I3*IF(ISNUMBER(SEARCH("CR",D3)),0.65,1)

Hi

 

Straight forward:

=IF(COUNTIF(D3,"*CR*"),0.65,1)*I3

Less straight forward:

=(1-COUNTIF(D3,"*CR*")*0.35)*I3

 

Thank you, thank you for the quick reply! That is exactly what I needed! :)
Thank you so much for the quick reply! Amazing that I have spent hours trying to figure this out! Thank you! :)
One more problem I just realized... if it finds INV in field D3, to make it come back with a zero?
best response confirmed by katie (Brass Contributor)
Solution

Another less straight forward solution:

=(1-MMULT({0.35,1},COUNTIF(D3,{"*CR*";"*INV*"})))*I3
You're a genius! Thank you so much!! Truly, thank you!!

Or with a lookup table:

=LOOKUP(2,1/COUNTIF(D3,"*"&{"";"CR";"INV"}&"*"),{1;0.65;0})*I3

Detlef, great!

 

Just for the collection the equivalent of MMULT

=(1-SUMPRODUCT(COUNTIF(D3,{"*CR*","*INV*"})*{0.35,1}))*I3

You guys are unbelievable! THANK YOU!! :)

SUMPRODUCT() was my first attempt, Sergej.

 

But I like MMULT() more than SUMPRODUCT().

:)

 

Yes, more sexy

Re: =(1-MMULT({0.35,1},COUNTIF(E2,{"*CR*";"*INV*"})))*G2

Found a little problem that I need more help with. :)

If column E2 has CR and INV, then it comes back with a negative number. Is there a way to add the If the column has both CR and INV, then come back with zero, not negative?

Katie, as variant that could be

 

=(1-MIN(MMULT({0.35,1},COUNTIF(E2,{"*CR*";"*INV*"})),1))*G2

 

That works perfectly!! Thank you so much Sergei! :)

It is sometimes frustrating for the helpers if you keep extendig the scope of the problem.

So, please always present the full scope of the problem in the first post.

=MAX(0,(1-MMULT({0.35,1},COUNTIF(E2,{"*CR*";"*INV*"}))))*G2
I totally understand, however I didn't realize these issues would arise until I ran the formula. ;)
1 best response

Accepted Solutions
best response confirmed by katie (Brass Contributor)
Solution

Another less straight forward solution:

=(1-MMULT({0.35,1},COUNTIF(D3,{"*CR*";"*INV*"})))*I3

View solution in original post