# Formula to add days to a date

#### sbaily

##### Board Regular
Hi

I need to able to create a formula to look at cell A2 if it equal to A then to look at cell b2 and add 20 days if A2 is equal to B then it should look at b2 but at 40 days

Cheers

Last edited:

### Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

#### sbaily

##### Board Regular
=IF(AX8="A",AR8+20,IF(AX8="B",AR8+40))

i tried this and it works for "A" but not "B"?

#### Yard

##### Well-known Member

=IF(A2=A1,B2+20,IF(A2=B1,B2+20,0))

#### Yard

##### Well-known Member
Oh now I understand your question (now you've put the "A" and "B" in quotes!)

Your formula is fine apart from an unspecified value_if_false in your second IF statement:

=IF(AX8="A",AR8+20,IF(AX8="B",AR8+40,"something here if neither A nor B"))

Replies
6
Views
460
Replies
18
Views
4K
Replies
3
Views
288
Replies
3
Views
354
Replies
3
Views
318

1,195,683
Messages
6,011,137
Members
441,587
Latest member
kbsgiri09

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

### Which adblocker are you using?

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

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