Solved

Find Value in a Row in Excel

Posted on 2015-01-12
4
61 Views
Last Modified: 2015-01-12
I have a spreadsheet and need to search a range in each row looking for a value (0). Example: Look in F12:P12 and if a 0 is found in any cell return 0 Else 1.
0
Comment
Question by:EMCIT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40544387
Sub DoIt()
For Each cel In Selection
    If cel.Value = "0" Then
        myAnswer = 0
        Exit For
    Else
        myAnswer = 1
    End If
Next
MsgBox myAnswer
End Sub

Open in new window

0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 40544389
=IF(COUNTIF(F12:P12,0),0,1)
should do it.
0
 
LVL 11

Author Comment

by:EMCIT
ID: 40544409
=IF(COUNTIF(F12:P12,0),0,1) works great. I have another column that needs to search specific columns as well.
Example: G12, I12, J12, M12, N12 only but when I try to string the cells it doesn't work.
0
 
LVL 11

Author Comment

by:EMCIT
ID: 40544441
I got it!

=IF(SUM(G22,I22,J22,M22,N22)=COUNT(G22,I22,J22,M22,N22),1,0)

Thank you for your assistance.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question