Using two equations in one cell

rholmes1303

New Member
Joined
Oct 27, 2011
Messages
3
I currently have a spreadsheet that has to calculate two things. One is an age difference between one person and their spouse. Excel will only calculate the difference if the first cell in the equation greater than the second. I would have to change the equation everytime the person in the second cell of the equation was older than the first. This has become a big inconvienince, so my question is how can I make two equations apply to one cell and have excel use whichever equation works and not use the equation that gives me the ######### or #VALUE! response. Thanks for any help!
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
DATEDIF(C9,C8,"y")&" years "&DATEDIF(C9,C8,"ym")&" months "

This is the equation i am using.... I would have to switch the C9 and C8 in the equation, I want to put the same equation twice in the same cell with the cells switched around and have excel use whichever works
 
Upvote 0
Try


=DATEDIF(MIN(C8,C9),MAX(C8,C9),"y")&" years "&DATEDIF(MIN(C8,C9),MAX(C8,C9),"ym")&" months "
 
Upvote 0

Forum statistics

Threads
1,214,429
Messages
6,119,435
Members
448,898
Latest member
dukenia71

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