ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   IF Function (https://www.excelbanter.com/excel-worksheet-functions/29264-if-function.html)

ExcelStress

IF Function
 

What formula would I use if I want to check 5 different cells and if
they are all equal then show In Balance , if not equal show Out of
Balance ?
Any help would be appreciated .
I know the formula to use if only comparing 2 cells , but can't figure
out how to compare more than 2 .

Thank you !


--
ExcelStress

Nick Hodge

How about

=IF(COUNTIF($A$1:$E$1,A1)=5,"In Balance", "Not In Balance")

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"ExcelStress" wrote in
message ...

What formula would I use if I want to check 5 different cells and if
they are all equal then show In Balance , if not equal show Out of
Balance ?
Any help would be appreciated .
I know the formula to use if only comparing 2 cells , but can't figure
out how to compare more than 2 .

Thank you !


--
ExcelStress




cscorp


Enter this function in a VBA MOdule in the workbook:

Function Balance(A, B, C, D, E) As String
'A,B,C,D,E are the references to the cells to be compared
If (A = B) And (B = C) And (C = D) And (D = E) Then
Balance = "In Balance"
Else
Balance = "Out Balance"
End If

End Function

Then enter the function name in the spreadsheet:
It will print "In Balance" / "Out Balnace" depending on the values in
cells A,B,C,D,E

Juan Carlos


--
cscorp
------------------------------------------------------------------------
cscorp's Profile: http://www.excelforum.com/member.php...o&userid=24015
View this thread: http://www.excelforum.com/showthread...hreadid=376556



All times are GMT +1. The time now is 03:40 AM.

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