+ Reply to Thread
Results 1 to 13 of 13

Excel reads blank cells as matching

  1. #1
    Registered User
    Join Date
    03-01-2015
    Location
    Cincinnati
    MS-Off Ver
    Office 2010
    Posts
    16

    Excel reads blank cells as matching

    Hello all,

    I work for a home builder and we have a rule in community building that the home to the left, home to the right and the home directly across the street cannot have the same floor plan with the same exterior elevation and color scheme as the home we are building.

    So, as an example if the floor plan was a "Florence with elevation "K" then no other surrounding home could be the same. However, there could be a Florence with elevation "B." - Floor plans are listed in column C and elevations are listed in a column D.

    Additionally, a home cannot share the same exterior color scheme. So, if the color scheme was "SUJ" then no other surrounding home, regardless of floor plan and elevation, could have the same color scheme. - Color schemes are listed in column B.

    The following formula works perfect with one exception - if I have cells without data (because no homes are built on that home site) then excel reads them as matching and "VIOLATION" populates in the cell. I need excel to ignore blank cells in the formula below.

    =IF(OR(B9=B8,B9=B10,AND(C9=C8,D9=D8),AND(C9=C10,D9=D10)),"VIOLATION","")

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,740

    Re: Excel reads blank cells as matching

    =IF(OR(B9=B8,B9=B10,AND(C9=C8,D9=D8),AND(C9=C10,D9=D10)),"VIOLATION","")

    so if any cell B8, B9, B10 ,C8, C9, C10 , D8, D9, D10 = a blank then you want a blank to be returned?

    you could add another IF - to test for a blank first

    or you could add another clause to the OR() in your main IF (OR(

    =IF( OR ( B8="", B9="", B10="" ,C8="", C9="", C10="" , D8="", D9="", D10 ="") , "", IF(OR(B9=B8,B9=B10,AND(C9=C8,D9=D8),AND(C9=C10,D9=D10)),"VIOLATION","") )

    that will at least stop the evaluation if any cell is blank()
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Excel reads blank cells as matching

    Or just start out with a quick test on 1 cell that will always be filled in for that row...

    =if(A8="","",IF(OR(B9=B8,B9=B10,AND(C9=C8,D9=D8),AND(C9=C10,D9=D10)),"VIOLATION",""))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    03-01-2015
    Location
    Cincinnati
    MS-Off Ver
    Office 2010
    Posts
    16

    Re: Excel reads blank cells as matching

    Quote Originally Posted by etaf View Post
    =IF(OR(B9=B8,B9=B10,AND(C9=C8,D9=D8),AND(C9=C10,D9=D10)),"VIOLATION","")

    so if any cell B8, B9, B10 ,C8, C9, C10 , D8, D9, D10 = a blank then you want a blank to be returned?

    you could add another IF - to test for a blank first

    or you could add another clause to the OR() in your main IF (OR(

    =IF( OR ( B8="", B9="", B10="" ,C8="", C9="", C10="" , D8="", D9="", D10 ="") , "", IF(OR(B9=B8,B9=B10,AND(C9=C8,D9=D8),AND(C9=C10,D9=D10)),"VIOLATION","") )

    that will at least stop the evaluation if any cell is blank()
    I plugged this in and I no longer receive a "VIOLATION" when there is a conflict of two matching cells. So, it doesn't show "VIOLATION" when they are blank, but it also doesn't show "VIOLATION" when it is supposed to.

  5. #5
    Registered User
    Join Date
    03-01-2015
    Location
    Cincinnati
    MS-Off Ver
    Office 2010
    Posts
    16

    Re: Excel reads blank cells as matching

    Quote Originally Posted by FDibbins View Post
    Or just start out with a quick test on 1 cell that will always be filled in for that row...

    =if(A8="","",IF(OR(B9=B8,B9=B10,AND(C9=C8,D9=D8),AND(C9=C10,D9=D10)),"VIOLATION",""))
    I was optimistic this would work however, I still receive the "VIOLATION" when the cells are blank.

  6. #6
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,740

    Re: Excel reads blank cells as matching

    Please upload a small clean sample of your data / workbook (not a picture) to the forum, Make sure you have removed any private information, remember this is a public forum and so available to anyone
    We would like to see an example of your data and also a manual mock up of the expected results you want to achieve.

    To attach a file to your post,
    click "Go advanced" (next to quick post),
    scroll down until you see "manage Attachments",
    click that and select "Choose File" (top Left corner).
    Find your file, click "Open" click "upload" click 'close windows" Top Right. click "Submit Reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.

  7. #7
    Registered User
    Join Date
    03-01-2015
    Location
    Cincinnati
    MS-Off Ver
    Office 2010
    Posts
    16

    Re: Excel reads blank cells as matching

    Thank you for the response.

    In the attachment you will see the formula in cell G26.

    I appreciate your help and let me know if you have additional questions.

    Chris
    Attached Files Attached Files

  8. #8
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,740

    Re: Excel reads blank cells as matching

    you have blank cells
    OR(B26="",B30="",B31="",C26="",C30="",C31="",D26="",D30="",D31="")

    so any of those if blank will result in a blank
    and as they are in your example the result is true , and blank

    you need to describe the blank issue further

  9. #9
    Registered User
    Join Date
    03-01-2015
    Location
    Cincinnati
    MS-Off Ver
    Office 2010
    Posts
    16

    Re: Excel reads blank cells as matching

    Ok, I have attached an updated spreadsheet with my original formula.

    You can view the formula in cell G26.

    If you type "SUM" into B26 ("SUM" matches the text in B30) or "SUJ" into B26 (matches text in B31) then you will see that G26 will turn red and say "VIOLATION." This is exactly what I want it to do.

    Also if you type "1680" into C26 and "A" into D26 then G26 turns red and says "VIOLATION." This also works perfect.

    Now, here is the problem: If you delete text from B30 or B31 then G26 turns red and says "VIOLATION". It is doing this because the formula is recognizing B26 and B30 as equal or B26 and B31 as equal.

    Also, if you delete C30 and D30 the formula is reading the empty cells as equal and I get the unwanted "VIOLATION" response. The same is true for C31 and D31.

    Let me know if this clarifies the problem for you.

    Thanks - Chris
    Attached Files Attached Files

  10. #10
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,740

    Re: Excel reads blank cells as matching

    =IF(OR(B26="",C26="", B30="", C30=""),"",IF(OR(B26=B30,B26=B31,AND(C26=C30,D26=D30),AND(C26=C31,D26=D31)),"VIOLATION",""))

    I have added a new clause , so that if any of the cells
    B26 or C26 or B30 or C30 is blank then set the cell to a blank

    you can change this to use the correct cell or range of cells
    to stop an empty cell = and empty cell
    not fully following the code and what you are testing - but you know what should never be blank

  11. #11
    Registered User
    Join Date
    03-01-2015
    Location
    Cincinnati
    MS-Off Ver
    Office 2010
    Posts
    16

    Re: Excel reads blank cells as matching

    Quote Originally Posted by etaf View Post
    =IF(OR(B26="",C26="", B30="", C30=""),"",IF(OR(B26=B30,B26=B31,AND(C26=C30,D26=D30),AND(C26=C31,D26=D31)),"VIOLATION",""))

    I have added a new clause , so that if any of the cells
    B26 or C26 or B30 or C30 is blank then set the cell to a blank

    you can change this to use the correct cell or range of cells
    to stop an empty cell = and empty cell
    not fully following the code and what you are testing - but you know what should never be blank
    Unfortunately this did not work correctly. It did stop the cell from having the VIOLATION when the cell is blank however, when you type a matching entry into B26 I no longer receive a VIOLATION message.

  12. #12
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,199

    Re: Excel reads blank cells as matching

    For this to work you need to define (using data) what is a "surrounding" plot..

    Take these formulae:

    =IF(OR(B9=B8,B9=B10,AND(C9=C8,D9=D8),AND(C9=C10,D9=D10)),"VIOLATION","")


    =IF(OR(B26="",C26="", B30="", C30=""),"",IF(OR(B26=B30,B26=B31,AND(C26=C30,D26=D30),AND(C26=C31,D26=D31)),"VIOLATION",""))


    The ranges are "specific" not "generic" so the formulae need amending each time to specific data ranges.

  13. #13
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Excel reads blank cells as matching

    Quote Originally Posted by JohnTopley View Post
    For this to work you need to define (using data) what is a "surrounding" plot.
    Agreed, given that many of the lot numbers are not consecutive, there is nothing definite to say which lot is to the immediate left or right of any other specific lot, and even less to identify the opposite lot.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Creating a excel file that reads and analyzes other excel files
    By B_Jarbs in forum Excel Programming / VBA / Macros
    Replies: 33
    Last Post: 12-29-2015, 03:45 AM
  2. [SOLVED] when matching the criteria copy cells and offset to blank column
    By ash3angel in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-10-2015, 03:29 PM
  3. Returning Blank Cells as errors when matching.
    By Fizban in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-21-2014, 04:12 AM
  4. Replies: 3
    Last Post: 03-26-2014, 10:45 AM
  5. [SOLVED] Ignore Blank cells in IF statement while matching columns
    By pareshvm in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-02-2014, 02:17 AM
  6. Cell Reads other cells from another Sheet
    By tex3285 in forum Excel General
    Replies: 1
    Last Post: 09-09-2011, 10:46 PM
  7. Exclude Blank cells when matching against other cells.
    By Neil07979 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-05-2008, 09:28 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1