#### Date ranges

```Hi

I have a list of predefined dates in column B in colum C formula to show
todays date. (i.e. if today = 24-6-06)

What I want is D1 to to show B2 (19-7-06) and D2 to show B1 (12-6-06)

A       B                C                D
1  1    12-6-06     =today()      next date =
2  2    19-7-06                        previous date =
3  3    24-8-06
4  4    30-9-06

Any help appreciated.

Regards

Paul T

```
 0
6/24/2006 5:11:53 PM
excel 39879 articles. 2 followers.

6 Replies
908 Views

Similar Articles

[PageSpeed] 8

```Paul T wrote:
> I have a list of predefined dates in column B in colum C formula to show
> todays date. (i.e. if today = 24-6-06)
> What I want is D1 to to show B2 (19-7-06) and D2 to show B1 (12-6-06)
>      A       B                C                D
> 1  1    12-6-06     =today()      next date =
> 2  2    19-7-06                        previous date =
> 3  3    24-8-06
> 4  4    30-9-06

Why doesn't the following obvious solution work for you:

D1:  =B2
D2:  =B1

I suspect there is something (a lot!) missing in the explanation of
what your truly want to do.  For example, as I interpret your question,
what you have in column C is irrelevant.

PS:  If you mean that you want to repeat that alternating pattern down
column D, cutting and pasting (or dragging the lower right corner of)
the pair will do the job.

```
 0
joeu2004 (766)
6/24/2006 5:18:46 PM
```Sorry should of explained that D1 is based on date in C1 looking up nearest
match in Column B (likewise for D2)
E.g. Tried =VLOOKUP(C1,B2:B4,1) but no joy

"Paul T" <paul.thomas5@ntlworld.com> wrote in message
news:tneng.46855\$lQ.19908@newsfe3-gui.ntli.net...
> Hi
>
> I have a list of predefined dates in column B in colum C formula to show
> todays date. (i.e. if today = 24-6-06)
>
> What I want is D1 to to show B2 (19-7-06) and D2 to show B1 (12-6-06)
>
>     A       B                C                D
> 1  1    12-6-06     =today()      next date =
> 2  2    19-7-06                        previous date =
> 3  3    24-8-06
> 4  4    30-9-06
>
> Any help appreciated.
>
> Regards
>
> Paul T
>

```
 0
6/24/2006 6:12:05 PM
```Paul T wrote:
> Sorry should of explained that D1 is based on date in C1 looking up nearest
> match in Column B (likewise for D2)
> E.g. Tried =VLOOKUP(C1,B2:B4,1) but no joy

Let me try to restate what you want.  You want to search column B for
the closest date on or after the date in C1.  In D1, you want the
matched date; in D2, you want the date from the row before the matched

There are some details to nail down.

If a date in column B exactly matches C1, do you truly want D1 to be
the matched date, as I stated; or do you want D1 to be the next date --
in which case, D2 would be the matched date?

And what if the matched date is B2, the first row of the table
searched?  There is no "previous date" in that case for D2.

And what if C1 exactly matches the last date in column B?  Depending on
no "next date" for D1.

The latter two boundary conditions can probably be handled by using
ISERROR() in an IF() function.  But they should be covered in a
complete solution -- or you might assure us that column B will be
designed so that those conditions cannot happen, in deference to
getting a more tractable solution.

```
 0
joeu2004 (766)
6/24/2006 6:49:48 PM
```Paul T wrote:
> Sorry should of explained that D1 is based on date in C1 looking up nearest
> match in Column B (likewise for D2)

Do you really mean "nearest"?  That is, if the date in C1 is more than
half way between two dates in column B, choose the latter; but if it is
less than half way between the two dates, choose the former.  (And who
knows what you want if C1 is exactly half way.)  I hope that is not
what you mean.

I wrote as a WAG:
> Let me try to restate what you want.  You want to search column B for
> the closest date on or after the date in C1.  In D1, you want the
> matched date; in D2, you want the date from the row before the matched
> date.  Is that about right?

Actually, it appears that the loopup functions are better suited for
doing this:  search column B for the closest date on or __before__ the
date in C1.  If that is what you want, then:

D1:  =offset(B1, lookup(C1, B1:B4, A1:A4), 0)
D2:  =vlookup(C1, B1:B4, 1)

That relies on the fact that in column A, you put the relative row
numbers of the table entries in column B.  Even if that does not apply
directly to your problem statement (which is still ill-defined, IMHO),
hopefully it gives you the tools for crafting your own solution.

I also wrote earlier:
> And what if the matched date is B2, the first row of the table
> searched?  There is no "previous date" in that case for D2.

"B2" was a typo.  It should be B1.

> The latter two boundary conditions can probably be handled by using
> ISERROR() in an IF() function.  But they should be covered in a
> complete solution -- or you might assure us that column B will be
> designed so that those conditions cannot happen, in deference to
> getting a more tractable solution

It would be better to design the table in column B so that the boundary
conditions never arise, assuming valid input in C1.  That is, for the
"on or before" search that I speculated, column B should contain a date
that is equal to or before any valid date that might be in C1, and
column B should contain a date that is after any valid date that might
go into C1.  Alternatively, you could write the following, for example:

D2:  =if(iserror(vlookup(C1, B1:B4, 1)), "", vlookup(C1, B1:B4, 1))

But the similar formula for D1 becomes __very__ messy because you must
account for the last date in column B.  As I said, simply design table
B with appropriate values to avoid the boundary conditions.  They can
be hidden rows, if you like.

-----

"Paul T" <paul.thomas5@ntlworld.com> wrote:
> I have a list of predefined dates in column B in colum C formula to show
> todays date. (i.e. if today = 24-6-06)
>
> What I want is D1 to to show B2 (19-7-06) and D2 to show B1 (12-6-06)
>
>     A       B                C                D
> 1  1    12-6-06     =today()      next date =
> 2  2    19-7-06                        previous date =
> 3  3    24-8-06
> 4  4    30-9-06
>
> Any help appreciated.
>
> Regards
>
> Paul T

```
 0
joeu2004 (766)
6/24/2006 10:37:07 PM
```Hi

You have cracked it with the Offset method!

I am not worried about a match date as what I intend to do is either prior
or after =today(). So I will always have a prior and after scenario.

I am very grateful for you guidence and assistance on this matter.

Thank you.

Paul T

<joeu2004@hotmail.com> wrote in message
> Paul T wrote:
>> Sorry should of explained that D1 is based on date in C1 looking up
>> nearest
>> match in Column B (likewise for D2)
>
> Do you really mean "nearest"?  That is, if the date in C1 is more than
> half way between two dates in column B, choose the latter; but if it is
> less than half way between the two dates, choose the former.  (And who
> knows what you want if C1 is exactly half way.)  I hope that is not
> what you mean.
>
> I wrote as a WAG:
>> Let me try to restate what you want.  You want to search column B for
>> the closest date on or after the date in C1.  In D1, you want the
>> matched date; in D2, you want the date from the row before the matched
>> date.  Is that about right?
>
> Actually, it appears that the loopup functions are better suited for
> doing this:  search column B for the closest date on or __before__ the
> date in C1.  If that is what you want, then:
>
> D1:  =offset(B1, lookup(C1, B1:B4, A1:A4), 0)
> D2:  =vlookup(C1, B1:B4, 1)
>
> That relies on the fact that in column A, you put the relative row
> numbers of the table entries in column B.  Even if that does not apply
> directly to your problem statement (which is still ill-defined, IMHO),
> hopefully it gives you the tools for crafting your own solution.
>
> I also wrote earlier:
>> And what if the matched date is B2, the first row of the table
>> searched?  There is no "previous date" in that case for D2.
>
> "B2" was a typo.  It should be B1.
>
>> The latter two boundary conditions can probably be handled by using
>> ISERROR() in an IF() function.  But they should be covered in a
>> complete solution -- or you might assure us that column B will be
>> designed so that those conditions cannot happen, in deference to
>> getting a more tractable solution
>
> It would be better to design the table in column B so that the boundary
> conditions never arise, assuming valid input in C1.  That is, for the
> "on or before" search that I speculated, column B should contain a date
> that is equal to or before any valid date that might be in C1, and
> column B should contain a date that is after any valid date that might
> go into C1.  Alternatively, you could write the following, for example:
>
>
> D2:  =if(iserror(vlookup(C1, B1:B4, 1)), "", vlookup(C1, B1:B4, 1))
>
> But the similar formula for D1 becomes __very__ messy because you must
> account for the last date in column B.  As I said, simply design table
> B with appropriate values to avoid the boundary conditions.  They can
> be hidden rows, if you like.
>
>
> -----
>
> "Paul T" <paul.thomas5@ntlworld.com> wrote:
>> I have a list of predefined dates in column B in colum C formula to show
>> todays date. (i.e. if today = 24-6-06)
>>
>> What I want is D1 to to show B2 (19-7-06) and D2 to show B1 (12-6-06)
>>
>>     A       B                C                D
>> 1  1    12-6-06     =today()      next date =
>> 2  2    19-7-06                        previous date =
>> 3  3    24-8-06
>> 4  4    30-9-06
>>
>> Any help appreciated.
>>
>> Regards
>>
>> Paul T
>

```
 0
6/25/2006 8:29:04 AM
```Paul T wrote:
> You have cracked it with the Offset method!

Glad it works for you.  One improvement....

I wrote:
> D1:  =offset(B1, lookup(C1, B1:B4, A1:A4), 0)
> [....]
> That relies on the fact that in column A, you put the relative row
> numbers of the table entries in column B.

No need to rely on column A.  You could do:

D1:  =offset(B1, match(C1, B1:B4), 0)

```
 0
joeu2004 (766)
6/25/2006 9:00:42 AM

Similar Artilces:

filter by date and action
I have a table with three columns: Name Date Action Fred Today this Fred Today this Fred Today that Wilma Today this I want to sort by name and by date, but only if 'this' was done more than once on the same day, and not if 'that' was done on the same day,They have to perform this more than once, and they cannot have performed that on the same day. If not in excel, mssql maybe? Thanks, Harry On Aug 18, 1:53=A0pm, Harry <hamac...@gmail.com> wrote: > I have a table with three co...

Calculate Years/Months Between Dates and then Average
We are using the formula =DATEDIF(A1,NOW(),"y") & "." & DATEDIF(A1,NOW(),"ym") to calculate the years and months from an employee hire date. Is there an easy way to average the years and months for a group of employees with the results of that formula? You could use: =AVERAGE(A1:A10*1) Array-entered, meaning press ctrl-shift-enter. But you could also just change your current formula to: =1*(DATEDIF(A1,NOW(),"y") & "." & DATEDIF(A1,NOW(),"ym")) Then just use: =AVERAGE(A1:A10) which is *not* array-entered. ...

Keeping a range constant when inserting rows
Hello, I'm trying to keep a range of cells constant within a function when I insert a row (e.g. average(a1:a6) becomes average(a1:a7) but I want it to keep the a1:a6 range). Even if I use absolute cell references (\$a\$1:\$a\$6), it doesn't help. I would greatly appreciate any ideas. Thanks, Jeff Jeff, In your formula, use: =AVERAGE(INDIRECT("A1:A6")) Absolute cell references (dollar signs) do one thing only: They keep any copies you make of the cell references from changing relatively as they're copied. They still change when the cells to which they refer are m...

copy range to multiple workbooks
Hi all, I have a good search around but have been unable to find what I am after, that being - I wish to copy a range - V1 to BK30 - from a single worksheet in what is my master workbook -"new_rtgs"- to any number of other workbooks which are copies made daily of the master workbook & which contain up to 30 worksheets. Basicaly this range contains formulas which analyse data I import to Colums A thru U. All the workbooks I need to copy to are housed in the same directory & are named by date - eg aug_01, aug_02 etc. Thanks in advance for any help provided. -- davez ---...

Our accounting department needs/wants to have all RMS SO reporting by business date opposed to transaction date. Usually these are the same unless you have sales and batches that close after midnight. For our store I would like to set 3 a.m. as the business day closing time. So when I run any type of reports I would like to get the information for a business date (range) starting at 3 a.m. till 3 a.m. the next day. I guess I could accomplish this by subtracting 3 hours from all the transaction (date and) times but I would have to do this for every single report which would be a lot of ...

Post Dated Checks
I had to prepare some post dated checks and we did not have fiscal periods set up yet to match the dates of the checks. Currently the check batches are waiting to be posted. What is the best way to handle post dated checks? If I create new fiscal years to match these dates, I will end up having 4 Open years. Is this the only way to do it? You can manage post dated checks in Microsoft Dynamics GP with the Payment Document Management module available on the Feature Pack 1 DVD image. For more info, take a look at MVP Mohammad Daoud's post on the subject at: https://communit...

Remove "Date: Yesterday" or "Date: Monday" from Outlook Inbox?
Outlook mail inbox now has headers that tell you what day the the email was sent. I find this visually annoying. Each emailalready has the time and day it was sent. I don't need the daily titles in the midst of the list of emails. How do I make them go away? I think you are talking about OL 2003 & the Arrange in Groups setting. Change it in View, Arrange by, uncheck Show in Groups. "silky" wrote: > Outlook mail inbox now has headers that tell you what day the the email was > sent. I find this visually annoying. Each emailalready has the time and day >...

strange date format problem
Hi, I downloaded some data on excel using Bloomberg. One column has dates and the other has numbers. Dates appear as 01/01/1980 format which I want in Jan-80 format. I have changed the format cell properties but it still appears as 01/01/1980. I have to goto individual cell and press F2 <enter> so see the effect. Dont know why? I cant even copy paste format after that .... TIA/amag I am not sure, but is your workbook set to Auto-Recalculate? Try pushing <F9> to do a manual re-calculation, see if that changes the formats. If it does, go to Tools (on the menu bar), Options, Ca...

How to sort by name then date?
I would like to look through all the emails to a particular person. If I click on the "To" column I can see all the emails to a particular person (actually there is a problem with that which I will mention next) but they seem to be in random order. Is there a way to have them sorted by date? (i.e. by name first, then by date). Actually, sorting on the "To" column does not get all the emails sent to a given email address. Because Outlook uses the "display as" field. It will often give different "display as" names to the same email address. C...

Concatenate including a date so that the date appears as a date
When I try to join the contents of several cells, one of which is a date and time obtained from =now(), the date and time part appears as a number. How can I make it appear as a date and time? I have tried changing the cell formats - probably there is a combination that works but I haven't found it. I also tried copying the original date cell to another cell and changing the latter cell's format and concatenating using that latter cell, but still no success. Use the TEXT function. For example, =TEXT(NOW(),"mmmm d, yyyy") would give January 6, 2010 "dd...

if statement with dates #2
I would like to have a statement like: IF(a1>0,1/1/2004) with 1/1/2004 beint a date. EXCEL is interpreting 1/1/2004 as an arithmetic statement and giving me the result of the arithemtic. I could put in the numeric offste for the date and write IF(a1>0,37987), formatting the cell as a date, but this seems awkward. What else can I do? TIA, Sanford ...

Count Unique Cells, within a date range (dates stored in separate column).
Hello All: I am attempting to create a formula that will count the number of unique cells (alpha-numeric) in an entire column (no set length, so ex: "\$B:\$B"). This count will be based on a date range (Between 2 dates). The dates are stored in another column (Ex: "\$A:\$A"). The following is an example of the cells. Dates PO_Num 1/2/2010 A123456 1/3/2010 B453453 2/2/2010 A123456 3/4/2010 C2342F3K 4/3/2010 123456 I would like to know a formula that can count the number of different PO's based on a given date range. Please help me if you...

Counting Dates?
=COUNTIF(A1:A100,"<" & NOW()) This works good for specific cells. I have a similar question. How would I do the same thing given that: 1) You only have a starting date 2) Your only wanting to count work days (in this case 4 day/wk) up to NOW() Thank you for all your help. Aviator On Thu, 6 Jan 2005 12:53:03 -0800, "Aviator" <Aviator@discussions.microsoft.com> wrote: >=COUNTIF(A1:A100,"<" & NOW()) > >This works good for specific cells. I have a similar question. > >How would I do the same thing given that: >1) You only ha...

An expression for dates from and to
I am trying to create an expression to select items from a date field falling from a certain date to a certain date. I am obviously missing something in my expression. The field name is DateComplete. How can I set up this expression to pull date from a certain date to a certain date? -- Ronnie Hi Ronnie, An example of the SQL would be: SELECT * FROM [TABLE NAME] WHERE DateComplete Between #1/1/2006# And #1/1/2007# ; On May 23, 3:52 pm, Ronnie <Ron...@discussions.microsoft.com> wrote: > I am trying to create an expression to select items from a date field falling > from a...

Returning only MAX(date) not all dates
I want to be able to list the most current date an item is checked out. As I was working through the query I used max as an aggregate function but I still can't get the simple result I want. I'd rather list the fields I have chosen and somehow select just the most current checkout date. Any help would be greatly appreciated. Here is my query: SELECT tblTerritory.TerritoryID, [TerritoryName] & " " & [TerritoryDescription] AS Description, tblTerritory.TerritoryTypeID, tblTerritoryType.TerritoryType, Max(tblTerritoryCheckout.DateCheckedOut) AS Checked...

External Data Range Properties #2
I am using Excel 97 to get data from a Access 97 DB. When I set the "Data layout" selection box of the External Data Range Properties dialogue box to "Overwrite existing cells with new data, clear unused cells" my data range works just fine. The problem come when I save/close the worksheet and then re-open. The "Data Layout" selection box defaults to "Insert entire rows for new data, clear unused cells" and subsequence data re-fresh causes a shift in the cells below the data I am importing. Is there an option or some way I can ensure that the ...

One Range, Two Colors
I am wondering if there is a way to get Excel to loop through a series of data, build a chart based on this series of data, and alternate the colors of the bars on the chart. I guess the even points have to be a variable (i.e., Points(2).Select, Points(4).Select, etc.) This kind of a pain to do if looking at only one series. This is the macro that I recorded: Sub Macro1() ActiveSheet.ChartObjects("Chart 1").Activate ActiveChart.SeriesCollection(1).Select With Selection.Border .Weight = xlThin .LineStyle = xlAutomatic End With With Selec...

System Date
Can anyone help me on how to force the system date to a member field of "Date" type? I could not find any help on msdn that comes with visual c++. Any hint or help will be appreciated. Thanks, Behrouzk Are you just trying to get the current date. You can use CTime::GetCurrentTime() or COleDateTime::GetCurrentTime() Tom "Behrouzk" <Behrouzk@discussions.microsoft.com> wrote in message news:D8FA4B6B-73CE-4058-B50C-C9BEBAB67E68@microsoft.com... > Can anyone help me on how to force the system date to a member field of > "Date" type? I could not fi...

Conditional Formatting
Hi, I have a spreadsheet that is for tracking work. I would like to have conditional formatting so that if the date in column E is between todays date and 4 weeks away then make it blue, if it is a date that is after 4 weeks away then make it yellow but if it is in the past make it red. Can this be done with conditional formatting or does it need vba? Also it would be nice if the whole row changes colour even if just the condition is on the date which is in column E - but if that can't be done then just the cell is fine. Thanks Assume the dates start in E2, select all dates w...

Time and date problem
Hello I have spreadsheet cell (B1) that contains a date and time: 05/11/2003 13:45:50 I have another series of cells (A1 to A100) that contain an increment of 30 seconds: 30.00 I would like to add the seconds to the date and time putting the result in column C, I have tried to do: =B1+(A1/100000) but the answer is wrong by 4 seconds and then gets worse the further down the column I go. Can somebody show me how to add the seconds to the date please. Thanks Tom Tom, Right method, wrong divider! 86,400 secs in a day.. change your 100000 to 86400 and you're there. Nikos Y. (nyannaco ...

Date subtraction -How to not show negative when 2nd date not entered
Hi, I have a section of a worksheet that just needs to show working days between two dates. For example, an order was entered on 9/2/07 and complete on 9/15/07 The formula =NETWORKDAYS(A1, A9) works perfectly except that until the "completed date" ise filled in, a negative number appears. Is there a way to have that remain blank until both dates have been entered? Thanks! Hi Edward, change your formula as =IF(A9="","",NETWORKDAYS(A1, A9)) -- Pranav Vaidya VBA Developer PN, MH-India If you think my answer is useful, please rate this post as an ANSWER...

PivotTable question
Thanks Debra, For some reason when on that Date field button in the Pivot table & choose the Group & Show Detail > Group I get a "Cannot group that selection" pop up message. I'll give the other tips a shot, I'm sure those will work. thanks again -- -= cj = ----------------------------------------------------------------------- -= cj =-'s Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1467 View this thread: http://www.excelforum.com/showthread.php?threadid=26305 If the date column contains text, or blank cells, you'll see th...

Select range from ActiveCell do to Lastcell in ColumnA
-- Thank you Aussie Bob C Little cost to carry knowledge with you. Win XP P3 Office 2007 on Mini Mac using VMware. Sub rangefinder() Dim rng As Range Set rng = Range(ActiveCell, Cells(Rows.Count, 1).End(xlUp)) MsgBox rng.Address 'do something with rng End Sub Gord Dibben MS Excel MVP On Mon, 15 Mar 2010 15:23:02 -0700, Aussie Bob C <AussieBobC@discussions.microsoft.com> wrote: Hi Gordon Sorry about double post. I require the range to include across to Column M. My second post states that. -- Thank you Aussie Bob C Little cost to carry...

Incorrect date in creation date field
I am having an issue when creating a template I am trying to use the date field called creation date but when it is inerted into the document it shows an incorrect date? For example the file was created and saved on May 26, 2006 but the creation date field show November 26, 2002. Has anyone else seen this problem? ...

Last Balanced Date
Does anyone know a quick way to get a list of accounts and the last date they were balanced? I'm finding myself having to select each account and manually check to see if it is up to date. I would think there would be a report of some kind that would display this somewhere, but I can't seem to find one. Any suggestions? Thanks in advance...Skip Skip, I've been thinking of the same exact question ever since I made the upgrade from Money 2004 to 2005. The ability to see the last balanced date across all accounts did exist in the 2004 version, and it was very useful. It...