Forum Discussion
Only show if there is a date in column
I want to only show the $ amount in Column A if there is a date. Everything I try I get an error. Here is the formula that I have that is totaling the amount now but the same amount shows all the way down and I do not want it to
Can someone help me out?
=IF(ISDATE(A3),SUM(D2+B3-C3)," ") -- this one throws an error so the one below is what I am currently using.
=SUM(D2+B3-C3)
Your time will be greatly appreciated.
Steve L
6 Replies
- PeterBartholomew1Silver Contributor
Taking @Subodh's reply a step further, an Excel date is a positive number and so will evaluate as TRUE if used in a logical statement ( 0 is FALSE). This means that
= IF( A3, D2+B3-C3, " " )
will do the same job. Mind you, I would prefer to read a formula such as
= IF( date, priorBalance+credit-debit, "-" )
but that is personal taste.
- Subodh_Tiwari_sktneerSilver Contributor
If we use the logical condition that way, the formula may return an error if the cell being checked, in this case A3, contains a string or A3 contains a formula which returns a blank string ("").
- PeterBartholomew1Silver Contributor
- Subodh_Tiwari_sktneerSilver Contributor
Excel treats dates as real numbers and there is no function called ISDATE in Excel, though VBA contains a function called IsDate().
You may replace your function with the following one to see if that returns the desired output.
=IF(ISNUMBER(A3),D2+B3-C3,"")
- Steve LuskCopper Contributor
- Subodh_Tiwari_sktneerSilver Contributor
You're welcome! Glad it worked as desired.
Please take a minute to accept the post with the proposed solution as a Best Response to mark your question as Solved.