Perform calculation if certain number in cell; otherwise, enter value from different cell

mcdcpa

New Member
Joined
Aug 5, 2022
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hi, all. I think what I need is pretty straightforward, but I'm nonetheless struggling to achieve it. I've got three columns of data. Column A shows age in days, Column B shows a status code (1, 2, 3, 4, or 5), Column C shows days in status, and Column D will show the results of the calculation. I need a formula that will subtract Column C from Column A if Column B = 5; otherwise, the value in Column C will be returned. I'm guessing an IF statement will accomplish this, but I'm having trouble coding the piece that would return the value in Column C if the status code is 1, 2, 3, or 4.

Thanks in advance.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

kevin9999

Well-known Member
Joined
Aug 28, 2020
Messages
1,003
Office Version
  1. 365
Platform
  1. Windows
How about

Excel Formula:
=IF(B2=5,A2-C2,C2)
 
Solution

Forum statistics

Threads
1,175,792
Messages
5,899,517
Members
434,778
Latest member
Alina N

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
Top