Help with IF statement

bellashahar

New Member
Joined
Nov 5, 2009
Messages
34
I need help with a formula.

Basically it's just H10-L10 (both are dates), however some in H and some in L show #VALUE! (this really can't be helped until data is populated).

So in my formula I would prefer if H or L has #VALUE! to return a blank cell instead of another #VALUE!

Any suggestions?

Thanks in advance.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
If you are using Excel 2007 or later

IFERROR(H10-L10,"",H10-L10)

if you are using an earlier value of excel:-

IF(ISERR(H10-L10),"",H10-L10)

This will also work on Excel 2007.Thanks

Kaps
 
Upvote 0
So I used VoG's formula

=IF(OR(ISERROR(H10),ISERROR(L10)),"",H10-L10)

Now is there a way to add something to color the cell if the dates fall in the same month? Like if H10 and L10 are both June then color the cell green. Or if the dates fall within two weeks of current date to color the cell yellow? :confused:

Again, thanks so much in advance for the help.
 
Upvote 0
If you are using Excel 2007 or later

IFERROR(H10-L10,"",H10-L10)
Wouldn't it just be this? (Edit: per rwheeler formula in post #2)

IFERROR(H10-L10,"")
 
Last edited:
Upvote 0
... however some in H and some in L show #VALUE! (this really can't be helped until data is populated).
It could be helped, by changing the formula that is producing the #VALUE error. The suggestions below are doing just that for your next formula, so presumably it could also be done for cells in column H and L. If you want to investigate that possibility, start by giving a current formula from column H and column L.
 
Upvote 0
You can use conditional formatting to color the cells based on certain conditions. Depending on which version of Excel you are using, find the conditional formatting button and select "New Rule". Choose the option that allows you to use a formula to determine which cells to format. In the rule description, paste "=MONTH(H10)=MONTH(L10)" for the "Same Month" rule and the click "Format" to specify what color to maek the cell if the condition is true.

For the "Less than 2 weeks" Rule, use "=(H10-L10)<14"

Hope this helps
 
Upvote 0
You can use conditional formatting to color the cells based on certain conditions. Depending on which version of Excel you are using, find the conditional formatting button and select "New Rule". Choose the option that allows you to use a formula to determine which cells to format. In the rule description, paste "=MONTH(H10)=MONTH(L10)" for the "Same Month" rule and the click "Format" to specify what color to maek the cell if the condition is true.

For the "Less than 2 weeks" Rule, use "=(H10-L10)<14"

Hope this helps

I'm not sure this is working right. I need it for all of H and L, not just row 10. Is that possible? or do manually have to create a new rule for each cell?
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,246
Members
449,075
Latest member
staticfluids

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