Formula to check text & return other text

Closed
issa - Oct 17, 2011 at 03:24 AM
 issa - Oct 17, 2011 at 08:35 AM
Dears who can help me.

The Case:
In Excel sheet, I have two column of data (for thousand of rows) and in the third column there is formula for each row that match both columns, so if there is any difference it will be written in the third column "ERROR" and if not will be empty.

Needed:
Now in separate cell (on the top of the sheet) I need as summary for any existing errors if any, so what I need, a formula that can look for a range (i.e: C5:C850) and to check if there is any Error word (it could be non or one or more than one). So if nothing found to be written "OK", and if any error found to write "ERROR found".

Thank a lot in advance to any kind assistance.
Issa
Related:

1 response

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Oct 17, 2011 at 05:52 AM
"in separate cell (on the top of the sheet)"
if this cell is C1

then try this macro

Sub test()
Dim cfind As Range
Set cfind = Range("C5:C850").Cells.Find(what:="error", LOOKAT:=xlWhole)
If Not cfind Is Nothing Then Range("c1") = "ERROR FOUND"
End Sub
0
Dear Venkat1926

Fisrt of all, thank a lot to your reply, I appreciate it.

But It didn't worked with me, or how shall I do it, by Macro or by VBA code, I alraedy wrote on the following VBA code but didn't got any reply.

Sub test()
Dim cfind As Range
Set cfind = Range("P6:P106").Cells.Find(what:="ERROR", LOOKAT:=xlWhole)
If Not cfind Is Nothing Then Range("S1") = "ERROR FOUND"
End Sub

Thank you in advance for any assistance.

Issa
0