Solved

Find Value in a Row in Excel

Posted on 2015-01-12
4
60 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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,…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

730 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