Solved

formula for reporting blanks and matches in excel

Posted on 2014-03-21
3
369 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now