How to use time with an If command?

  • Thread starter Thread starter david.jordan1
  • Start date Start date
D

david.jordan1

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
 
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?
 
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?

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
 
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

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.
 
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.

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
 
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

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.
 
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- Dölj citerad text -

- 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
 
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.

--
Lasse Vågsæther Karlsen
mailto:[email protected]://presentationmode.blogspot.com/
PGP KeyID: 0xBCDEA2E3- Hide quoted text -

- Show quoted text -

Thanks Lasse - that's a big help.
David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top