Sun and Moon states

Spindoctor

New Member
Joined
May 19, 2009
Messages
3
Hi

As you can see I'm a first time poster. I have spent the last 48 hours trying to find help on the below, suceeded in getting some way to the formula but seem to be falling at the last post! I have checked the forum, but can't find anything similar on which to compare.

To give you some background: I'm undertaking a 100km charity walk in a few weeks. Along the way we have checkpoints where we can change kit, refuel etc. In order to work out where we'd be at approximate times i've put together a spreadsheet that totals times based on average speed etc. All that seems to be working fine.

The bit I'm having a challenge with is as follows:

We'll be walking through the night and into the morning. I want to know roughly which stages we'll be walking in the dark. I have placed the time for sunrise in one cell and sunset in another.

In can make the formula work to an extent, but I can't work out how to make it revert back to the 'sun' state after sunrise!
The formula at present is: =IF(G8<=$C$4,"SUN","MOON")

G8 is the time of day we'll be at each checkpoint (formatted hh:mm am/pm)
$c$4 is sunset
$c$5 is sunrise

I'm using Excel 2003. Can anyone provide some assitance?
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Welcome to the Board.

Try:

=IF(AND(G8>=$C$5,G8<$C$4),"SUN","MOON")

Make sure your times don't include a date.
 

Domski

Well-known Member
Joined
Jan 18, 2005
Messages
7,292
I'm undertaking a 100km charity walk in a few weeks.
A friend of mine is doing a similar thing around the Leeds area.

Best of luck, hope it goes well for you :)

Dom
 

Spindoctor

New Member
Joined
May 19, 2009
Messages
3
Thanks for the help and the message of luck - my feet need it. Weirdly, the statements are still not changing when dawn breaks.

I have posted the spreadsheet in question, should you wish to review it and tell me why i'm being such a fool!

http://www.box.net/shared/z8g0yn2319
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Because your times include a date (from G16 onwards) you need:

=IF(AND(MOD(G8,1)>=$C$5,MOD(G8,1)<$C$4),"SUN","MOON")
 

Forum statistics

Threads
1,082,280
Messages
5,364,210
Members
400,786
Latest member
ismi88

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top