Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-20-2023, 12:40 PM
wsnow wsnow is offline Calculate date from two variable fields, with no #value error in empty rows Windows 10 Calculate date from two variable fields, with no #value error in empty rows Office 2019
Novice
Calculate date from two variable fields, with no #value error in empty rows
 
Join Date: Sep 2023
Posts: 24
wsnow is on a distinguished road
Question Calculate date from two variable fields, with no #value error in empty rows

In my workbook, column I contains a formula that returns a date based on the manually entered date in column H (though that is irrelevant to the formula I need). Column K also contains a manually entered date.

I need a formula for column Q that will:
1. See if there is a date in I and/or K.
2. If no date appears in either, return a blank in that row.


3. If there is a date in column K, return that date to column Q plus 12 months.
4. If there is no date in column K, but there is a date in column I, return that date to column Q plus 12 months.

I've tried several formulas, each time I am either able to get the dates to calculate correctly but end up with a #VALUE error in column Q when the column I cell is "blank" because it's reading the formula there, or I don't get the error, but the formula seems to be ignoring the date in column I so that if there is no date in column K, it returns a blank.

Here's what I've tried so far.
=IF(AND(ISNUMBER($I2), ISNUMBER($K2)), IF($K2<>"", $K2+365, IF($I2<>"", $I2+365, "")), "") Returns date in column K, with no error on empty rows, but if I delete the number in column K, it ignores column I and returns a blank.

=IF(AND(ISNUMBER($I2), ISNUMBER($K2)), IF($K2<>"", $K2+365, $I2+365), IFERROR(1/0, "")) Same as above.

=IF(AND($K2="", $I2=""), "", IF($K2<>"", DATE(YEAR($K2)+1, MONTH($K2), DAY($K2)), DATE(YEAR($I2)+1, MONTH($I2), DAY($I2)))) Handles the dates correctly but returns #VALUE error in rows with no input.

I also tried =IF(ISBLANK($K2),IF(ISBLANK($I2),"",EDATE($I2,12)) ,EDATE($K2,12)) Same results as the previous.

Maybe the answer lies in somehow combining the two, but I don't know how.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error handling input to a Date variable CuriousG Excel Programming 2 04-05-2022 08:51 AM
Run Time Error '91': Object variable or With block variable not set using Catalogue Mailmerge Berryblue Mail Merge 1 11-13-2014 05:36 PM
Calculate date from two variable fields, with no #value error in empty rows Run-time error 91 object variable or with block variable not set JUST ME Word VBA 4 03-25-2014 06:56 AM
Calculate date from two variable fields, with no #value error in empty rows Run-time error '91': Object variable or With block variable not set tinfanide Excel Programming 2 06-10-2012 10:17 AM
30+ days Variable Day Date Calculations via Fields ztag Word 2 01-06-2012 11:12 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:34 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft