Help with If formula

desibouy

Board Regular
Joined
Nov 20, 2014
Messages
98
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm struggling here I'm sure the formula was working at one point and now I can't get it to work.

Code:
=
IF(AND(N11="CA",ISNUMBER(SEARCH("INCONTINENCE",V11))),ROUNDUP(KP11/0.66+6.95,0)-0.01,
IF(AND(N11="PK",ISNUMBER(SEARCH("INCONTINENCE",V11))),ROUNDUP(KP11/0.66+3,0)-0.01)),
IF(AND(N11="BG",ISNUMBER(SEARCH("INCONTINENCE",V11))),ROUNDUP(KP11/0.66+3,0)-0.01)),
ROUNDUP(KP11/0.66,0)-0.01

Basically if it's a CA and V11 contains Incontinence then KP11/.66 + 6.95
If it's PK or BG and V11 contains Incontinence then KP11/.66+3 otherwise any other item KP11/.66.

Thanks
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Code:
=if(
 and(n11="ca",isnumber(search("incontinence",v11))),
 roundup(kp11/0.66+6.95,0)-0.01,
 if(
  and(n11="pk",isnumber(search("incontinence",v11))),
  roundup(kp11/0.66+3,0)-0.01,
  if(
   and(n11="bg",isnumber(search("incontinence",v11))),
   roundup(kp11/0.66+3,0)-0.01,
   roundup(kp11/0.66,0)-0.01
    )
   )
   )
 
Upvote 0
you don't have enough ) at the end - there should be 3
you could cut the number of nested if statements with a OR(n11="PK",n11="BG")
As all your examples look for the string in V11 I'd lead with that so

=IF(ISNUMBER(SEARCH("INCONTINENCE",V11)),IF(N11="CA",ROUNDUP(KP11/0.66+6.95,0)-0.01,IF(OR(N11="PK",N11="BG"),ROUNDUP(KP11/0.66+3,0)-0.01,KP11/0.66)),KP11/0.66)

I have assumed that you want to do the KP11/0.66 if N11 doesn't = CA, PK or BG AND if V11 doesn't contain Incontinence.

HTH

Miles
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,320
Members
452,635
Latest member
laura12345

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