Solved

formula for reporting blanks and matches in excel

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

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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,…
Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

708 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

18 Experts available now in Live!

Get 1:1 Help Now