Solved

Question for an excel formula

Posted on 2012-03-25
7
319 Views
Last Modified: 2012-03-26
I want to compare 2 Excel cells as per the following

if A1 < A2 then highlight A2 cell

I'm using Excel 2010. How can I do this?
0
Comment
Question by:Gerhardpet
  • 3
  • 3
7 Comments
 
LVL 50

Expert Comment

by:barry houdini
ID: 37763272
Try Conditional formatting

Select A2 then on "Home" tab - Conditional formatting > New rule > Use a formula to determine which cells to format > type this formula in the box

=A1<A2

Select required formatting > OK

You can also apply that to a larger range if required

regards, barry
0
 
LVL 1

Author Comment

by:Gerhardpet
ID: 37763307
Ok I did what you told which works but I can't figure out how to apply it to a large range of cells. When I use the format Painter it does the following

My rule is =A1<B1 then highlight in red

Now when I use the format painter my next row is =A1<B2 but I want it to be A2<B2

Does that make sense?
0
 
LVL 5

Assisted Solution

by:chinawal
chinawal earned 250 total points
ID: 37763343
Gerhardpet,
See attached excel.
I had a rule =A1<B1 then highlight in red
I was able to use the format painter on next row correctly i.e. A2<B2

So, not sure, what exact issue you are having.
book1.xlsx
0
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.

 
LVL 50

Accepted Solution

by:
barry houdini earned 250 total points
ID: 37763351
Make sure you don't use any $ signs in the formula otherwise that will "fix" the cell references.

If you want to apply to a larger range you can simply change the "Applies to" range in the conditional formatting rule

regards, barry
0
 
LVL 1

Author Comment

by:Gerhardpet
ID: 37763579
So far it does not work. I think what I need is for each cell to have a new rule.

chinawal, in your attachment you do not have a rule for each cell.

I found that I can create a new rule in one cell at the time using the format painter but that is still a lot of work considering that I have about 100 cells
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 37763627
No, you don't need a new rule for each cell.

Chinawal's suggestion does what you want I believe. Although the rule says

=A2<B2

that will adjust for each cell in the "applies to" range. Look at the results: 4 in B3 is highlighted (because it > 3 in A3) while the 4 in B7 is not highlighted (because it isn't > 4 in A7).

In Excel 2003 the conditional formatting formula explicitly changed for each cell - after 2007 that changed, you only see a single rule.......but the rule applies "as is" to the first cell in the "applies to" range (B2), and then adjusts (implicitly) for all cells in the range as if copied down as a worksheet formula [=A2<B2 in row 2 will adjust to =A3<B3, =A4<B4 etc. )

So you have 3 options

1 - choose just B2 and apply that formula, then use format painter to copy to other cells,

2 - choose just B2 and apply that formula, then change "applies to" range to whatever range is required,

3. select whole range, e.g. B2:B100 and apply that same formula

All of those methods will work

regards, barry
0
 
LVL 1

Author Closing Comment

by:Gerhardpet
ID: 37765361
Thank you for the help. I had to remove the $ and then it worked
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
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…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

743 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

11 Experts available now in Live!

Get 1:1 Help Now