Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / February 2008

Tip: Looking for answers? Try searching our database.

How to use time with an If command?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
david.jordan1@googlemail.com - 18 Feb 2008 20:56 GMT
Can anyone tell me what formula i could use to perform a function
whenever for example,the month of April or perhaps the 31 days of a
specific month appears in the data.

I would be most grateful for any help.
Thanks
David
Jon Skeet [C# MVP] - 18 Feb 2008 21:01 GMT
> Can anyone tell me what formula i could use to perform a function
> whenever for example,the month of April or perhaps the 31 days of a
> specific month appears in the data.

That's a fairly general question - could you give more specifics about
what you mean by "appears in the data"? What data are you talking
about?

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk

david.jordan1@googlemail.com - 18 Feb 2008 21:14 GMT
>  <david.jord...@googlemail.com> wrote:
> > Can anyone tell me what formula i could use to perform a function
[quoted text clipped - 8 lines]
> Jon Skeet - <sk...@pobox.com>http://www.pobox.com/~skeet  Blog:http://www.msmvps.com/jon.skeet
> World class .NET training in the UK:http://iterativetraining.co.uk

Thanks for responding so quickly Jon.
Below is 3 columns and if you imagine that the time column extends to
a full year.
Time                          x values                    Y values
15/02/2008 17:15    1590158.49    9.12
15/02/2008 17:30    1590168.64    10.15
15/02/2008 17:45    1590178.3     9.66
15/02/2008 18:00    1590187.91    9.61
15/02/2008 18:15    1590197.4                    9.49
What i want to do is if the first column contains the month of feb
then add the corresponding x and y values
IE taking the first line, the first column does represent a day in Feb
so add 1590158.49 and 9.12 which will produce 1590167.61

Thanks
David
Jon Skeet [C# MVP] - 18 Feb 2008 22:12 GMT
<snip>

> Thanks for responding so quickly Jon.
> Below is 3 columns and if you imagine that the time column extends to
[quoted text clipped - 9 lines]
> IE taking the first line, the first column does represent a day in Feb
> so add 1590158.49 and 9.12 which will produce 1590167.61

And how do you have this data stored? What code do you already have?

Just to check (and I know this seems like an odd question) - you are
actually using C#, aren't you? Some of the terminology you used made me
wonder whether you actually meant to post to an Excel group.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk

david.jordan1@googlemail.com - 18 Feb 2008 22:35 GMT
>  <david.jord...@googlemail.com> wrote:
>
[quoted text clipped - 23 lines]
> Jon Skeet - <sk...@pobox.com>http://www.pobox.com/~skeet  Blog:http://www.msmvps.com/jon.skeet
> World class .NET training in the UK:http://iterativetraining.co.uk

This is just data displayed in an excel spreadsheet.As you have picked
up,i'm no software expert.I was just wanting to use an if command
which would look at the calander date and if a certain month was
displayed,would perform a function.I dont,or rather ,have never used
visual basic.If this is not possible using a simple IF command,i would
appreciate the code in visual basic and attempt to do it that way.
Thanks
David
Lasse Vågsæther Karlsen - 18 Feb 2008 22:48 GMT
>>  <david.jord...@googlemail.com> wrote:
>>
[quoted text clipped - 9 lines]
>>> 15/02/2008 18:00   1590187.91      9.61
>>> 15/02/2008 18:15   1590197.4                        9.49
<snip>
> This is just data displayed in an excel spreadsheet.As you have picked
> up,i'm no software expert.I was just wanting to use an if command
[quoted text clipped - 4 lines]
> Thanks
> David

You're most likely better off in a newsgroup for the Office products,
like microsoft.public.excel.

However, I think you can try to add the following in a column off to the
right of your data, in row 2, and then copy/paste the formula to rows
downwards:

=IF(MONTH(A2)=2;B2;0)

This will produce the value in the B-column, row 2, if the date/time in
the A-column, row 2, is in february, otherwise it will produce the value 0.

Note that A2 and B2 are based on the fact that your Time column is the A
column, and your "x values" column is the B column (the one containing
1590158.49 etc.), and that the captions Time, x values, etc. are in the
first row so the data appears in the second row. If this doesn't fit
your spreadsheet, adjust the formula appropriately.

But as I said, you should probably try to followup this question in
microsoft.public.excel or a similar newsgroup.

Signature

Lasse Vågsæther Karlsen
mailto:lasse@vkarlsen.no
http://presentationmode.blogspot.com/
PGP KeyID: 0xBCDEA2E3

david.jordan1@googlemail.com - 19 Feb 2008 19:50 GMT
On Feb 18, 10:48 pm, Lasse Vågsæther Karlsen <la...@vkarlsen.no>
wrote:
> david.jord...@googlemail.com wrote:
> >>  <david.jord...@googlemail.com> wrote:
[quoted text clipped - 47 lines]
>
> - Show quoted text -

Thanks Lasse - that's a big help.
David
christery@gmail.com - 18 Feb 2008 22:48 GMT
On 18 Feb, 23:35, david.jord...@googlemail.com wrote:

> >  <david.jord...@googlemail.com> wrote:
>
[quoted text clipped - 34 lines]
>
> - Visa citerad text -

So: stating the obvious...
1)an Excel problem,
2)wondering if VB(A) would help,
3) posted in a C# group....
Is It just me or...
I have a problem with the right taste of Thai Tom Yum Kung soup but...
(Oh, got a Karl.E flashback) *smile*
//CY

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.