Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 460
Default Need help with a function

I want to have Excel give back a certain value if it meets some criteria.

Example: If the value of a cell is between 0 & 5%, then give back 10%.
If the value of a cell is between 6 & 10%, then give back 9%.

thx for your help!

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default Need help with a function

Hi,

Best solution is VLOOKUP or similar function

Make a table with the something like this
0 10%
6% 9%

=VLOOKUP(A1,B$1:C$3,2)

Assuming the table is in B1:C3 and the value you want checked is in A1.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Doug" wrote:

I want to have Excel give back a certain value if it meets some criteria.

Example: If the value of a cell is between 0 & 5%, then give back 10%.
If the value of a cell is between 6 & 10%, then give back 9%.

thx for your help!

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default Need help with a function

On Jan 28, 5:00*pm, Doug wrote:
I want to have Excel give back a certain value if it meets
some criteria. Example: *If the value of a cell is between
0 & 5%, then give back 10%. If the value of a cell is between
6 & 10%, then give back 9%.


And if neither pair of conditions is met, ...?

=if(and(0<=A1,A1<=5%), 10%, if(and(6%<=A1,A1<=10%), 9%, "")

That formula does exactly what you ask for. But there is much wrong
with what you ask for.

1. What if 5%<A1 and A1<6%? What if A1<0 or 9%<A1?

2. When you say "between", do you mean, for example, 0<=A1 and A1<=5%
as I wrote; or do you mean 0<A1 and A1<5%?

3. I assume that "the cell" (A1) does indeed contain a percentage or a
fractional value representing a percentage. Or do you mean: the
value in the cell is some percentage of something that you failed to
mention?

4. Be wary of the difference between displayed value (0, 5%, 6%, 10%)
and the actual value. The displayed value might be rounded
automatically, which might mislead you. In light of that, perhaps you
want:

=if(and(0<=A1,round(A1,2)<=5%), 10%, if(and(6%<=round(A1,2),round(A1,2)
<=10%), 9%, "")
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Need help with a function

If you only have a "few" conditions to check for...

=IF(COUNT(A1),IF(A1<=5%,10%,IF(A1<=10%,9%,"")),"")

If you have "many" conditions to check for then you're best option is to
create a lookup table. See this for more detail:

http://contextures.com/xlFunctions02.html

--
Biff
Microsoft Excel MVP


"Doug" wrote in message
...
I want to have Excel give back a certain value if it meets some criteria.

Example: If the value of a cell is between 0 & 5%, then give back 10%.
If the value of a cell is between 6 & 10%, then give back 9%.

thx for your help!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ISBLANK function not working when cell is blank dut to function re mcmilja Excel Discussion (Misc queries) 9 May 7th 23 03:43 AM
copy of excel file not showing formulal/function in the function b oaallam Excel Discussion (Misc queries) 4 September 6th 07 01:20 PM
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) [email protected] Excel Worksheet Functions 0 September 5th 06 03:44 PM
Offset function with nested match function not finding host ss. MKunert Excel Worksheet Functions 1 March 21st 06 10:46 PM
Emulate Index/Match combo function w/ VBA custom function Spencer Hutton Excel Worksheet Functions 2 May 2nd 05 05:26 PM


All times are GMT +1. The time now is 12:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"