# Need help with code!

#### walky82

##### New Member
Hey can some one please help me....

I am not to sure why this code is not working....

=IF(AND((D17=6),((YEAR(NOW())-YEAR(K5))<25),(N13>=3),(F11+H11+J11+L11+N11)=0),5,IF(AND((D17=6),((YEAR(NOW())-YEAR(K5))<25),(N13>=5),(F11+H11+J11+L11+N11)=0),3,D17))

All i want this to do is.... either put a 5 or a 3 and if not just put whatever is in D17, but it wont work...

Thanks heaps in advance!

### Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use \$ signs: \$V\$2:\$Z\$99 will always point to V2:Z99, even after copying

#### northwolves

##### Well-known Member
Try:
=(D17=6)*(YEAR(NOW()-YEAR(K5))<25)*(F11+H11+J11+L11+N11=0)*IF(N13>=5,3,IF(N13>=3,5,D17))

Regards
Northwolves

#### walky82

##### New Member
Thanks for your help but that didn't work.

Not to sure why not... Thanks anyways

#### northwolves

##### Well-known Member
All i want this to do is.... either put a 5 or a 3 and if not just put whatever is in D17, but it wont work...
-------------------
A bit Ambiguous ,maybe an example can help you to Explanate it.

Regards
Northwolves

#### walky82

##### New Member
Sorry mate about the ambiguity.. This a two scenarios that can be either true or false...<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o></o>
=IF(AND((D17=6),((YEAR(NOW())-YEAR(K5))<25),(N13>=3),(F11+H11+J11+L11+N11)=0),5, - If this statement is true a 5 will be entered into that cell. <o></o>
<o></o>
<o></o>
IF(AND((D17=6),((YEAR(NOW())-YEAR(K5))<25),(N13>=5),(F11+H11+J11+L11+N11)=0),3, - If this statement in true it will put a 3 in the cell<o></o>
<o></o>
<o></o>
D17)) - If not whatever is in cell d17 will appear in the cell<o></o>

Replies
4
Views
333
Replies
1
Views
219
Replies
3
Views
265
Replies
5
Views
377
Replies
23
Views
572

Threads
1,190,603
Messages
5,981,890
Members
439,743
Latest member
KatieO

### 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

### 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