#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default If and a date

I have a formula that gives me the first day of the week that a
transaction took place.

=K2-WEEKDAY(K2)+2

This works fine so long as there is a date in "K2" but if it is blank
then i get a #Value. error
I have tried using various "if" statements to say if K2 is blank then
the destination cell should also be blank. But all of my "if"
statements keep giving errors. (K2 is formatted as dd-mmm-yyyy if that
makes a difference.)

What is the best way to write this please.

Bob

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default If and a date


Try the following:

=IF(ISBLANK(K2),"",K2-WEEKDAY(K2)+2)

Or this, which covers just about everything:

IF(ISERROR(K2-WEEKDAY(K2)+2),"",K2-WEEKDAY(K2)+2)
--
Kevin Backmann


"Box666" wrote:

I have a formula that gives me the first day of the week that a
transaction took place.

=K2-WEEKDAY(K2)+2

This works fine so long as there is a date in "K2" but if it is blank
then i get a #Value. error
I have tried using various "if" statements to say if K2 is blank then
the destination cell should also be blank. But all of my "if"
statements keep giving errors. (K2 is formatted as dd-mmm-yyyy if that
makes a difference.)

What is the best way to write this please.

Bob


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default If and a date

On 24 Jan, 18:12, Kevin B wrote:
Try the following:

=IF(ISBLANK(K2),"",K2-WEEKDAY(K2)+2)

Or this, which covers just about everything:

IF(ISERROR(K2-WEEKDAY(K2)+2),"",K2-WEEKDAY(K2)+2)
--
Kevin Backmann



"Box666" wrote:
I have a formula that gives me the first day of the week that a
transaction took place.


=K2-WEEKDAY(K2)+2


This works fine so long as there is adatein "K2" butifit is blank
then i get a #Value. error
I have tried using various "if" statements to sayifK2 is blank then
the destination cell should also be blank. But all of my "if"
statements keep giving errors. (K2 is formatted as dd-mmm-yyyyifthat
makes a difference.)


What is the best way to write this please.


Bob- Hide quoted text -


- Show quoted text -


Thanks, option 2 sorted it.

Bob
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default If and a date

If K2 was truly blank, your formula would return -5

You have something in K2 in order to produce the #VALUE! error.

A space perhaps or "" created from a formula in K2?


Gord Dibben MS Excel MVP

On Thu, 24 Jan 2008 10:06:44 -0800 (PST), Box666
wrote:

I have a formula that gives me the first day of the week that a
transaction took place.

=K2-WEEKDAY(K2)+2

This works fine so long as there is a date in "K2" but if it is blank
then i get a #Value. error
I have tried using various "if" statements to say if K2 is blank then
the destination cell should also be blank. But all of my "if"
statements keep giving errors. (K2 is formatted as dd-mmm-yyyy if that
makes a difference.)

What is the best way to write this please.

Bob


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dates - Need to display date one month prior to user-entered date brettopp Excel Worksheet Functions 13 December 3rd 07 05:58 PM
how to get the random date between the start date and the end date? Sebation Excel Worksheet Functions 3 October 13th 07 12:20 PM
Report Date - Date Recv = Days Late, but how to rid completed date MS Questionnairess Excel Worksheet Functions 1 January 24th 07 11:05 PM
Formula for determining if two date columns fall within specific date range Igottabeme Excel Worksheet Functions 2 April 21st 06 02:50 AM
Date updates from worksheet to chart & changes date to a date series! Help!! Jayjg Charts and Charting in Excel 2 January 22nd 05 03:00 PM


All times are GMT +1. The time now is 06:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"