Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Capture te first n digits of a range

Hello,
I'm writing a UDF that defines R as range(A1:A10)which contains either
nothing or integer numbers 10000.
The UDF uses a multi-condition sum that should look like :

Application.Sumproduct
((Range("A1:A10")1000)*(Range("A1:A10")<2000)*(Ra nge("B1:B10")))
But the problem is that instead of range("A1:A10") I want the left 4
digits of A1:A10 to compare with.
What is the most efficiënt code for this ?

Thanks for your help.
Herman

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Capture te first n digits of a range

Function OddOne(rng As Range, rng2 As Range)

OddOne = Evaluate("=SUMPRODUCT(--(LEFT(" & rng.Address & ",4)+01000)," & _
"--(LEFT(" & rng.Address & ",4)+0<2000)," & rng2.Address & ")")
End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


wrote in message
ups.com...
Hello,
I'm writing a UDF that defines R as range(A1:A10)which contains either
nothing or integer numbers 10000.
The UDF uses a multi-condition sum that should look like :

Application.Sumproduct
((Range("A1:A10")1000)*(Range("A1:A10")<2000)*(Ra nge("B1:B10")))
But the problem is that instead of range("A1:A10") I want the left 4
digits of A1:A10 to compare with.
What is the most efficiënt code for this ?

Thanks for your help.
Herman


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Capture te first n digits of a range


Bob Phillips schreef:

Function OddOne(rng As Range, rng2 As Range)

OddOne = Evaluate("=SUMPRODUCT(--(LEFT(" & rng.Address & ",4)+01000)," & _
"--(LEFT(" & rng.Address & ",4)+0<2000)," & rng2.Address & ")")
End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


wrote in message
ups.com...
Hello,
I'm writing a UDF that defines R as range(A1:A10)which contains either
nothing or integer numbers 10000.
The UDF uses a multi-condition sum that should look like :

Application.Sumproduct
((Range("A1:A10")1000)*(Range("A1:A10")<2000)*(Ra nge("B1:B10")))
But the problem is that instead of range("A1:A10") I want the left 4
digits of A1:A10 to compare with.
What is the most efficiënt code for this ?

Thanks for your help.
Herman


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
Excel screen capture to capture cells and row and column headings jayray Excel Discussion (Misc queries) 5 November 2nd 07 11:01 PM
In a range of months can I capture the most current month entry? Karlene Excel Discussion (Misc queries) 4 August 15th 07 05:55 PM
Macro to capture cell value then use it for a relative range selec PZ Straube Excel Programming 8 June 13th 05 08:28 AM
Capture Dynamic Range address into Modeless Form pining[_2_] Excel Programming 0 November 11th 04 08:05 AM
Delete Rows & Capture Range sameer27p[_22_] Excel Programming 3 August 5th 04 05:43 AM


All times are GMT +1. The time now is 10:36 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"