Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

formula for reporting blanks and matches in excel

Posted on 2014-03-21
3
Medium Priority
?
380 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 1000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

886 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