Monthly Archives: May 2012

Change the font color based on the value in the cell in Excel 2010

Question: In Excel 2010, I’m putting the sum of 3 cells in a 4th cell. If the sum is greater than 10, I would like the sum to be the color red. If the sum is less than 10, I would like the sum to be the color blue. Is this possible?

Answer: If you wish to change the color of the font based on the value in a cell, you will need to apply conditional formatting.

To do this, select the cell that you wish to apply the formatting to. In this example, we’ve selected cell B8.

 

Select the Home tab in the toolbar at the top of the screen. Then in the Styles group, click on the Conditional Formatting drop-down and select Manage Rules.

 

When the Conditional Formatting Rules Manager window appears, click on the “New Rule” button to enter the first condition.

 

When the New Formatting Rule window appears, select Format only cells that contain as the rule type.

Then select Cell Value in the first drop down, greater than in the second drop down, and enter 10 in the final box. In our example, we’ve selected when the cell value is greater than 10.

Next, we need to select what formatting to apply when this condition is met. To do this, click on the Format button.

 

When the Format Cells window appears, select the formatting conditions that you wish to apply. We’ve changed the Color to Red. Then click on the OK button.

 

When you return to the New Formatting Rule window, you should see the preview of the formatting in the Preview box. In this example, the preview box shows the text in red. Next click on the OK button.

 

This will return you to the Conditional Formatting Rules Manager window.

If you wish to apply more than one condition, you will need to click on the New Rule button again.

 

When the New Formatting Rule window appears, we need to set up the second condition.

Select Format only cells that contain as the rule type.

Then select Cell Value in the first drop down, less than in the second drop down, and enter 10 in the final box. In our example, we’ve selected when the cell value is less than 10.

Next, we need to select what formatting to apply when this second condition is met. To do this, click on the Format button.

 

When the Format Cells window appears, select the formatting conditions that you wish to apply to the second condition. We’ve changed the Color to Blue. Then click on the OK button.

 

When you return to the New Formatting Rule window, you should see the preview of the formatting in the Preview box. In this example, the preview shows the text in blue. Next click on the OK button.

 

We’ve added two different conditions. When you’re done, click on the OK button.

 

Excel Cell Counting Techniques

Excel provides many ways to count cells in a range that meet various criteria:

  • The DCOUNT function. The data must be set up in a table, and a separate criterion range is required.
  • The COUNT function. Simply counts the number of cells in a range that contain a number.
  • The COUNTA function. Counts the number of non-empty cells in a range.
  • The COUNTBLANK function. Counts the number of empty cells in a range.
  • The COUNTIF function. Very flexible, but often not quite flexible enough.
  • An array formula. Useful when the other techniques won’t work.

Formula Examples

Listed below are some formula examples that demonstrate various counting techniques. These formula all use a range named data.

To count the number of cells that contain a negative number:

  =COUNTIF(data,"<0")

To count the number of cells that contain the word “yes” (not case sensitive):

   =COUNTIF(data,"yes")

To count the number of cells that contain any text:

   =COUNTIF(data,"*")

To count the number of cells that contain text that begins with the letter “s” (not case-sensitive):

   =COUNTIF(data,"s*")

To count the number of cells that contain the letter “s” (not case-sensitive):

   =COUNTIF(data,"*s*")

To count the number of cells that contain either “yes” or “no” (not case-sensitive):

   =COUNTIF(data,"yes")+COUNTIF(data,"no")

To count the number of three-letter words:

   =COUNTIF(data,"???")

To count the number of cells that contain a value between 1 and 10:

   =COUNTIF(data,">=1")-COUNTIF(data,">10")

To count the number of unique numeric values (ignores text entries):

   =SUM(IF(FREQUENCY(data,data)>0,1,0))

To count the number of cells that contain an error value (this is an array formula, entered with Ctrl+Shift+Enter):

   =SUM(IF(ISERR(data),1,0))

Using the formulas in VBA

You can also use these techniques in your VBA code. For example the VBA statement below calculates the number of three-letter words in a range named data, and assigns the value to the NumWords variable:

  NumWords = Application.COUNTIF(Sheets("Sheet1").Range("data"), "???")

The other formula examples listed above can also be converted to VBA.

 

Original source from : http://spreadsheetpage.com/index.php/tip/cell_counting_techniques/

In Depth: All About NASA’s Curiosity Mars Rover

NASA may not be sending up manned shuttles anymore, but that doesn’t mean we’re done exploring the solar system — not by a long shot. On August 5, the space agency’s new flagship rover is expected to land on Mars as part of an unprecedented search for traces of life on the Red Planet.

You can ascertain the rover’s importance simply by its size. This thing is huge compared to NASA’s previous explorers, Spirit and Opportunity. Curiosity measures 3m long, 2.7m wide, and 2.1m tall — taller than the average NBA centre — weighing a hefty 907kg. NASA’s previous pair weighed just 185kg apiece. Tack on the added reach of Curiosity‘s 2.1m long manipulation arm and the rover has roughly a two-storey vertical reach. Not that there are many two-storey-tall objects around the rover’s planned landing site but a good ability to have, nonetheless.

To move beyond wherever it comes to rest after being lowered via sky crane from the Mars Lander Engine, Curiosity will rely on a set of six oversized wheels attached to a rocker-bogie suspension, much like its predecessors. Fun fact: the wheel treads will leave an impression in the Martian soil spelling “JPL” in Morse code. Why? Who cares, it’s cool. The rover will propel itself along at up to a relatively-swift 91 metres per hour in automatic drive with an average speed of just 30 metres per hour when hunting for signs of life. In all, this $US2.5 billion program is going to traverse just 19.3km during its two-year stay on Mars.

Powering the scientific behemoth is some surprisingly old tech. Curiosity relies on a radioisotope thermoelectric generator (RTG) — the same nuclear engine that powered the Viking Spacecrafts from the 1970s — but hey, you stick with what works. These engines generate an electrical charge from the heat created by the 4.5kg power cell’s decay of plutonium-238 — 125W of electrical power at the start of the mission decreasing to about 100W at the end of the plutonium’s 14-year life span. That heat is also employed to keep the rover’s fluids and mechanisms from freezing during the cold Martian nights. You could even say that NASA’s built itself a warm-blooded robot.

Beyond keeping the rover itself alive, the RTG system will power the machine’s extensive suite of sensors, X-Band transmitter, UHF radio, a pair of onboard computers — each with 256KB of EEPROM, 256MB of DRAM, and 2GB of flash — and an Inertial Measurement Unit (IMU) that helps the rover keep track of its bearings and balance with 3-axis sensor input. And gadgets. Hooo boy, does it have gadgets.

The Rover boasts a trio of primary cameras: the 720p multi-spectrum Matcam, the Mars Hand Lens Imager which is attached to the arm and capable of taking 1600 x 1200 microscopic shots, and the Mars Descent Imager, which will snap five frames/second for about two minutes as the rover makes its final approach to the surface. It also sports four hazard-avoidance cameras and a pair of stereoscopic navigation cameras.

Some would call Curiosity a rolling geology lab — and they’d be right. It’s packed to the gills with scientific instruments: X-ray spectrometer, a laser-induced breakdown spectroscopy (LIBS) system, rock-vapourising lasers, organic sample analysis systems; and even radiation and neutrino detection systems. In fact, during the year-long trip to Mars, Curiosity is actually standing in for a human astronaut, recording the amount of solar radiation that penetrates the spacecraft. August 5 can’t get here fast enough. [WikipediaJPL]