Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Determining if values in a column range are of same value.

Hello,

Was wondering if there is a built in command or more efficent way to
determine if values in a column range are the same.

The simplest, but maybe not the most efficient way i can think of is to do:

activesheet.Range("a1").Formula = "=Min('sheet1'!B1:B1000)"
activesheet.Range("a2").Formula = "=Max('sheet1'!B1:B1000)"
if activesheet.Range("a1").value = activesheet.Range("a2").value then
'values in column range are the same.
end if

Anyone think of a more efficient way of dong this? Does excel have some sort
of similar built in function?

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Determining if values in a column range are of same value.

Hello Bing

One way:

If Evaluate("Min(B1:B1000)") = Evaluate("Max(B1:B1000)") Then
MsgBox "All the same"
End If

--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"Bing" skrev i en meddelelse
...
Hello,

Was wondering if there is a built in command or more efficent way to
determine if values in a column range are the same.

The simplest, but maybe not the most efficient way i can think of is to

do:

activesheet.Range("a1").Formula = "=Min('sheet1'!B1:B1000)"
activesheet.Range("a2").Formula = "=Max('sheet1'!B1:B1000)"
if activesheet.Range("a1").value = activesheet.Range("a2").value then
'values in column range are the same.
end if

Anyone think of a more efficient way of dong this? Does excel have some

sort
of similar built in function?

Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Determining if values in a column range are of same value.

Most of the worksheet functions are available in VBA:

if application.Min(Range("Sheet1").Range("B1:B1000")) = _
application.Max(Range("Sheet1").Range("B1:B1000")) then

--
Regards,
Tom Ogilvy


"Bing" wrote in message
...
Hello,

Was wondering if there is a built in command or more efficent way to
determine if values in a column range are the same.

The simplest, but maybe not the most efficient way i can think of is to

do:

activesheet.Range("a1").Formula = "=Min('sheet1'!B1:B1000)"
activesheet.Range("a2").Formula = "=Max('sheet1'!B1:B1000)"
if activesheet.Range("a1").value = activesheet.Range("a2").value then
'values in column range are the same.
end if

Anyone think of a more efficient way of dong this? Does excel have some

sort
of similar built in function?

Thanks!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Determining if values in a column range are of same value.

Another way

If application.countif(range("B1:B1000"),range("B1")) =
Range("B1:B1000").Cells.Count
' same

--

HTH

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


"Bing" wrote in message
...
Hello,

Was wondering if there is a built in command or more efficent way to
determine if values in a column range are the same.

The simplest, but maybe not the most efficient way i can think of is to

do:

activesheet.Range("a1").Formula = "=Min('sheet1'!B1:B1000)"
activesheet.Range("a2").Formula = "=Max('sheet1'!B1:B1000)"
if activesheet.Range("a1").value = activesheet.Range("a2").value then
'values in column range are the same.
end if

Anyone think of a more efficient way of dong this? Does excel have some

sort
of similar built in function?

Thanks!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Determining if values in a column range are of same value.

Thanks! you guys are great!

"Bob Phillips" wrote:

Another way

If application.countif(range("B1:B1000"),range("B1")) =
Range("B1:B1000").Cells.Count
' same

--

HTH

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


"Bing" wrote in message
...
Hello,

Was wondering if there is a built in command or more efficent way to
determine if values in a column range are the same.

The simplest, but maybe not the most efficient way i can think of is to

do:

activesheet.Range("a1").Formula = "=Min('sheet1'!B1:B1000)"
activesheet.Range("a2").Formula = "=Max('sheet1'!B1:B1000)"
if activesheet.Range("a1").value = activesheet.Range("a2").value then
'values in column range are the same.
end if

Anyone think of a more efficient way of dong this? Does excel have some

sort
of similar built in function?

Thanks!






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Determining if values in a column range are of same value.

determine if values in a column range are the same.

If they are all numbers, perhaps another option:

If [STDEV(A1:B1000)] = 0 Then MsgBox "All same numbers"

--
Dana DeLouis
Win XP & Office 2003


"Bing" wrote in message
...
Hello,

Was wondering if there is a built in command or more efficent way to
determine if values in a column range are the same.

The simplest, but maybe not the most efficient way i can think of is to
do:

activesheet.Range("a1").Formula = "=Min('sheet1'!B1:B1000)"
activesheet.Range("a2").Formula = "=Max('sheet1'!B1:B1000)"
if activesheet.Range("a1").value = activesheet.Range("a2").value then
'values in column range are the same.
end if

Anyone think of a more efficient way of dong this? Does excel have some
sort
of similar built in function?

Thanks!



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
calculate values in an unlimited range of cells in a column WITHOUTalso calculating values that had previously been filtered AGAINST? yadang Excel Discussion (Misc queries) 2 October 1st 09 06:18 PM
Count Unique Values in 1 Column based on Date Range in another Column Brian Excel Worksheet Functions 14 May 17th 09 02:58 PM
Determining the size of a range. Dave the wave Excel Programming 3 June 30th 04 01:47 AM
Excel VBA - determining range donfon13 Excel Programming 3 June 23rd 04 09:46 PM
Determining range Sam Carleton Excel Programming 3 October 31st 03 11:55 PM


All times are GMT +1. The time now is 12:17 AM.

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

About Us

"It's about Microsoft Excel"