ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Evaluating a group of cells (https://www.excelbanter.com/excel-discussion-misc-queries/194350-evaluating-group-cells.html)

John

Evaluating a group of cells
 
I want to be able to have a message in a cell that alerts users to the value
in each of the four cells being the same:

EG If A1,B1,C1,D1 are all the same value then put a message in B1.

I tried to use the AND function but it came back as false. Any ideas please
on how i might do this.

Thanks
John

Cimjet[_2_]

Evaluating a group of cells
 
Hi John
You can't have a function in B1 and a number to evaluate with other cells.
Put this =IF(AND(B1=A1,B1=C1,B1=D1),"All the same","Not the same") in an
empty cell and try it if its what you want.
Regards
Cimjets
"John" wrote in message
...
I want to be able to have a message in a cell that alerts users to the
value
in each of the four cells being the same:

EG If A1,B1,C1,D1 are all the same value then put a message in B1.

I tried to use the AND function but it came back as false. Any ideas
please
on how i might do this.

Thanks
John



Gary''s Student

Evaluating a group of cells
 
Try this worksheet event macro:

Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("A1:D1")
Set b1 = Range("B1")
Set t = Target
If Intersect(t, r) Is Nothing Then Exit Sub
a = Range("A1").Value
b = Range("B1").Value
c = Range("C1").Value
d = Range("D1").Value
b1.ClearComments
If a = b And b = c And c = d Then
b1.AddComment
b1.Comment.Visible = True
b1.Comment.Text Text:="WARNING!!!"
End If
End Sub


Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm


--
Gary''s Student - gsnu200794


"John" wrote:

I want to be able to have a message in a cell that alerts users to the value
in each of the four cells being the same:

EG If A1,B1,C1,D1 are all the same value then put a message in B1.

I tried to use the AND function but it came back as false. Any ideas please
on how i might do this.

Thanks
John


David Biddulph[_2_]

Evaluating a group of cells
 
What AND formula did you use?
Do the cells contain text or numbers?
If text, are you sure that some don't have extraneous spaces or other
non-printing characters?
If numbers, are you sure that there aren't small rounding errors?

Also, how could you put a message in B1, if B1 is one of the input cells?
--
David Biddulph

"John" wrote in message
...
I want to be able to have a message in a cell that alerts users to the
value
in each of the four cells being the same:

EG If A1,B1,C1,D1 are all the same value then put a message in B1.

I tried to use the AND function but it came back as false. Any ideas
please
on how i might do this.

Thanks
John





All times are GMT +1. The time now is 11:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com