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!
 

Some videos you may like

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

rholmes1303

New Member
Joined
Oct 27, 2011
Messages
3
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
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try


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

Watch MrExcel Video

Forum statistics

Threads
1,123,088
Messages
5,599,664
Members
414,325
Latest member
kfg1287

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