Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

data selection

0

If after doing a sum cell A1 = any figure between 30.01&40 I want cell B1 to automatically become 2%

Answer
Discuss

Discussion

Please don't forget to select the answer that worked for you! Just click the Select Answer button at the bottom of the desired answer.
don (rep: 1989) Nov 22, '17 at 10:42 am
Add to Discussion

Answers

0

This requires two separate steps.

  1. Enter this formula in the cell where you want the output.
    =IF(AND($A1>30,$A1<=40),2%,0)
  2. Set a custom format for that same cell.
    Right-click on the cell, select Format cells, select the Number tab, select Custom and write this formula in the Type field.
    0%;;

The cell formula will either write 0 or 0.02 to the cell. This is important to know in case you wish to do calculations with this result.

The cell format willl change the value of 0.02 into 2% and hide the zero. Zero is better than "" because it is a number. If you wish to show it, remove the two semicolons from the formatting mask. The other part of the mask ("2%") determines the format of the number. You could make this "0 %" (with a space) or "0.0%" (with a decimal digit) or any other valid number format.

Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login