corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Geek Day » Help with holiday planner :o)


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author Help with holiday planner :o)
A2H GO
Member

Registered: 14th Sep 04
Location: Stoke
User status: Offline
28th Oct 11 at 13:57   View User's Profile U2U Member Reply With Quote

Ive done the template.

It two worksheets, a logging sheet and a summary sheet.

It relys on staff entering a prefix followed by the number of hours. eg. For 7 hours holiday they enter H7.

Where I'm stuck is that I don't know how to total up the different prefixes on the summary sheet. Not sure whether it can be done using formula or if code is needed...

Link to file is here:

http://www.filetolink.com/8244aa2c

A2H GO
Member

Registered: 14th Sep 04
Location: Stoke
User status: Offline
28th Oct 11 at 14:37   View User's Profile U2U Member Reply With Quote

I've done a simple table as an example of what i need.



In the Total hol column I need a forumla that will look to see if theres a H in the cell, if so it will add the numbers next to it.

So in this example the total hol will equal 9.
ashleh
Member

Registered: 23rd Dec 08
Location: Nottingham
User status: Offline
28th Oct 11 at 15:18   View User's Profile U2U Member Reply With Quote

This is in Excel right? Hows your programming skills .
A2H GO
Member

Registered: 14th Sep 04
Location: Stoke
User status: Offline
28th Oct 11 at 15:30   View User's Profile U2U Member Reply With Quote

Not good, hence using formula

I'm really close actually:

=SUMPRODUCT((LEFT(B5:G5,1)="H")*(RIGHT(B5:G5,LEN(B5:G5)-1)))

This returns the total of the numbers in the cell if it contains a H, ie. It returns 9 in the example above.

The only problem I'm having is that if one of the cells is blank it returns #VALUE!
ashleh
Member

Registered: 23rd Dec 08
Location: Nottingham
User status: Offline
28th Oct 11 at 16:08   View User's Profile U2U Member Reply With Quote

If statement? I was thinking VBA but you might be able to do it your way with a little tweaking.
Dom
Member

Registered: 13th Sep 03
User status: Offline
28th Oct 11 at 16:16   View User's Profile U2U Member Reply With Quote

Have a look at the ISBlank funtion or ISError, one of those should help you. Although doing it in VBA would be a lot easier (just the case of looping through the range with a simple IF Statement).
A2H GO
Member

Registered: 14th Sep 04
Location: Stoke
User status: Offline
28th Oct 11 at 17:42   View User's Profile U2U Member Reply With Quote

Cheers Dom.

I had a go with VBA and failed miserably.
A2H GO
Member

Registered: 14th Sep 04
Location: Stoke
User status: Offline
28th Oct 11 at 18:17   View User's Profile U2U Member Reply With Quote

Done it!

=SUM(IF(LEFT(C17:G17,1)="H",--RIGHT(C17:G17,LEN(C17:G17)-1)))

ashleh
Member

Registered: 23rd Dec 08
Location: Nottingham
User status: Offline
28th Oct 11 at 19:10   View User's Profile U2U Member Reply With Quote

I'm guessing you spent about 2 hours googling? That's what I usually do .
Dom
Member

Registered: 13th Sep 03
User status: Offline
28th Oct 11 at 19:25   View User's Profile U2U Member Reply With Quote

quote:
Originally posted by A2H GO
Cheers Dom.

I had a go with VBA and failed miserably.

code:

TotalHoliday = 0
For Each LoopCell In Worksheets("Sheet1").Range("B5:G5").Cells
If LoopCell.value <> "" And Mid(LoopCell.value,1,1) = "H" Then TotalHoliday = TotalHoliday + Mid(LoopCell.value,2,1)
Next
Range("G6").Value = TotalHoliday



Something like that although that only does one row so you'd need to put the above in another loop that goes through all the rows (obviously updating the row number in the inner-loop).
A2H GO
Member

Registered: 14th Sep 04
Location: Stoke
User status: Offline
28th Oct 11 at 20:52   View User's Profile U2U Member Reply With Quote

quote:
Originally posted by ashleh
I'm guessing you spent about 2 hours googling? That's what I usually do .


Yes
A2H GO
Member

Registered: 14th Sep 04
Location: Stoke
User status: Offline
28th Oct 11 at 20:52   View User's Profile U2U Member Reply With Quote

quote:
Originally posted by Dom
quote:
Originally posted by A2H GO
Cheers Dom.

I had a go with VBA and failed miserably.

code:

TotalHoliday = 0
For Each LoopCell In Worksheets("Sheet1").Range("B5:G5").Cells
If LoopCell.value <> "" And Mid(LoopCell.value,1,1) = "H" Then TotalHoliday = TotalHoliday + Mid(LoopCell.value,2,1)
Next
Range("G6").Value = TotalHoliday



Something like that although that only does one row so you'd need to put the above in another loop that goes through all the rows (obviously updating the row number in the inner-loop).


Nice one, I'll have a play about with this on Monday!

 
New Topic

New Poll

  Related Threads Author Forum Replies Views Last Post
urgent - online route planner? SetH General Chat 3 195
26th Feb 03 at 09:53
by SetH
 
Route Planner Sites Sam General Chat 8 177
1st May 03 at 19:57
by kinkycorsa
 
All you cockney rebels and southern fairies MarkM General Chat 44 942
15th May 07 at 20:45
by Stavs
 
Sky planner upgrade (HD) JM Curdy Geek Day 14 239
29th Jul 09 at 12:40
by corsadee
 
Excel Locked down? A2H GO Geek Day 2 282
27th Oct 11 at 18:42
by A2H GO
 

Corsa Sport » Message Board » Off Day » Geek Day » Help with holiday planner :o) 29 database queries in 0.0114439 seconds