Solved

formula for reporting blanks and matches in excel

Posted on 2014-03-21
3
374 Views
Last Modified: 2014-03-21
In Excel I use this IF formula to determine a comparison of two adjacent cells first to see if they are blank and second to see if they are the same value (but not blank)
I have this array formula which almost works.
=IF(OR(AK2="",AL2=""),"BothBlank",IF(AK2=AL2,"Same",AK2=AL2))

I am not permitted to change the data so I am looking to see if cells are blank (vs 0) and if not blank are they the same.
example
AK2= John  AL2=John  should return "Same"
AK2= "" AL2= "" should return BothBlank
 however if there is one cell blank and the other one has value it still says both blank.
I think I need to add another argument to return "Mixed" if AK2 <>AL2 however I cant seem to get it right.  I believe that <> is excels version of "does not equal".
0
Comment
Question by:lithocolor
3 Comments
 
LVL 23

Expert Comment

by:NBVC
ID: 39946056
I think this should do...

=IF(AND(AK2="",AL2=""),"",IF(AK=AL2,"Same","Mixed"))
0
 
LVL 13

Expert Comment

by:Santosh Gupta
ID: 39946235
Try this

=IF(AND(AK2="John",AL2="John"),"Same",IF(AND(AK2="",AL2=""),"Both Blank",""))
0
 
LVL 12

Accepted Solution

by:
tel2 earned 250 total points
ID: 39946338
Hi lithocolor,
This works for me:
    =IF(AND(AK2="",AL2=""),"BothBlank",IF(AK2=AL2,"Same","Mixed"))

After writing the above, I noticed that it's the same as NBVC's answer, except that:
- He had an 'AK' typo (should have been 'AK2'), and
- Mine returns 'BothBlank' when both cells are blank (as per your spec's), while his returns an empty cell.

Santosh's solution will never return 'Mixed' and will only return 'Same' if both cells contain the name 'John' (i.e. no other words/names).

lithocolor, you are correct about the '<>' operator, and we could use it here for tests like:
    =IF(AK2<>AL2,"Mixed","Same")
but this kind of thing is probably more readable (positive thinking):
    =IF(AK2=AL2,"Same","Mixed")
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

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
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…

820 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