Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Question about intervals and results

Hey, I'm having these (hopefully simple problems) with writing in page numbers:
(I also posted this in the newbie section, but maybe it fits better here?)

1. I want to write ex. 7-19 in a cell -
Then in another cell I want excel to give the result of the interval of,
here 12.

2. Now, if that's possible, I also want to ask this:
In one cell i want to write 2 or more different interval, ex
7-19, 81-90.

Can I make excel understand what I'm writing somehow? And get the result of
these intervals in another cell, here 21 (12+9)

Any help will be extremely appreciated - thanks in advance, steve.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Question about intervals and results

Range("A1").Value = "'7-19"
Range("A2").Value = "'7-19,81-90"
Range("B1:B2").Formula = "=-Sum(" & Range("A1").Text & ")"

--
Regards,
Tom Ogilvy

"Steve" wrote in message
...
Hey, I'm having these (hopefully simple problems) with writing in page

numbers:
(I also posted this in the newbie section, but maybe it fits better here?)

1. I want to write ex. 7-19 in a cell -
Then in another cell I want excel to give the result of the interval of,
here 12.

2. Now, if that's possible, I also want to ask this:
In one cell i want to write 2 or more different interval, ex
7-19, 81-90.

Can I make excel understand what I'm writing somehow? And get the result

of
these intervals in another cell, here 21 (12+9)

Any help will be extremely appreciated - thanks in advance, steve.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Question about intervals and results

Hi,
You could use the user-defined worksheet function bellow.
One thing i have changed in your requirement is the page counting. You say
7-19 should return 12, but shouldn't it return 13? Eg: 3-4 would return 2 and
not 1.

'--------------------------------------------------------------
Public Function PInterval(S As String) As Double
Dim v, v1

v = Split(S, ",")
For Each v1 In v
PInterval = PInterval + CDbl(Evaluate("-(" & v1 & ")+1"))
Next
End Function
'-----------------------------------------------------------
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Steve" wrote:

Hey, I'm having these (hopefully simple problems) with writing in page numbers:
(I also posted this in the newbie section, but maybe it fits better here?)

1. I want to write ex. 7-19 in a cell -
Then in another cell I want excel to give the result of the interval of,
here 12.

2. Now, if that's possible, I also want to ask this:
In one cell i want to write 2 or more different interval, ex
7-19, 81-90.

Can I make excel understand what I'm writing somehow? And get the result of
these intervals in another cell, here 21 (12+9)

Any help will be extremely appreciated - thanks in advance, steve.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Subtotal Results question Richardb Excel Discussion (Misc queries) 2 October 7th 07 04:31 AM
Excel formula question - sending results to another cell [email protected] Excel Discussion (Misc queries) 6 January 29th 07 08:38 PM
5 minutes intervals april Excel Worksheet Functions 2 October 24th 06 12:32 AM
Newbie question about intervals and results Steve New Users to Excel 2 September 9th 05 05:43 PM
Time intervals below 1 second. Derek[_6_] Excel Programming 2 December 27th 03 07:30 PM


All times are GMT +1. The time now is 08:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"