#1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 31
Default Macro

Hi i need to write a macro and have no idea how to do it if some one can show
me form scratch

Ihave different formalus in different column which calculate commission for
agent
Eg : if(d1247300,"$15",if(d1247100,"$12","$10"))-(j1247+k1247)

=IF(D12461500,"$25",IF(D12461000,"$20",IF(D1246 500,"$15","10")))-(J1246+K1246)

this 2 different formula in same column

i want to write a macro so i dont have to use two different formula when i
say certain column is X then its should run 1st formula if i select "y" it
should run 2nd formula.

Any help is appreciated.


--
Nisha P
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 11,501
Default Macro

hi,

Before attempting to answer your question what is "$15" etc in your formula
because it seems to me that the only correct answer you formula can return is
when none of the conditions evaluate as true (D1246 is less than 500) and the
formula returns J1246+K1246.

If any condition does evaluate as TRUE then it tries to subtract J1246+K1246
from a text value and gives an error.

Mike

"nishkrish" wrote:

Hi i need to write a macro and have no idea how to do it if some one can show
me form scratch

Ihave different formalus in different column which calculate commission for
agent
Eg : if(d1247300,"$15",if(d1247100,"$12","$10"))-(j1247+k1247)

=IF(D12461500,"$25",IF(D12461000,"$20",IF(D1246 500,"$15","10")))-(J1246+K1246)

this 2 different formula in same column

i want to write a macro so i dont have to use two different formula when i
say certain column is X then its should run 1st formula if i select "y" it
should run 2nd formula.

Any help is appreciated.


--
Nisha P

  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 31
Default Macro

its the formula which calculates amount if the sent amount is lessthen $100
then charge should be $10, so on and so forth.

--
Nisha P


"Mike H" wrote:

hi,

Before attempting to answer your question what is "$15" etc in your formula
because it seems to me that the only correct answer you formula can return is
when none of the conditions evaluate as true (D1246 is less than 500) and the
formula returns J1246+K1246.

If any condition does evaluate as TRUE then it tries to subtract J1246+K1246
from a text value and gives an error.

Mike

"nishkrish" wrote:

Hi i need to write a macro and have no idea how to do it if some one can show
me form scratch

Ihave different formalus in different column which calculate commission for
agent
Eg : if(d1247300,"$15",if(d1247100,"$12","$10"))-(j1247+k1247)

=IF(D12461500,"$25",IF(D12461000,"$20",IF(D1246 500,"$15","10")))-(J1246+K1246)

this 2 different formula in same column

i want to write a macro so i dont have to use two different formula when i
say certain column is X then its should run 1st formula if i select "y" it
should run 2nd formula.

Any help is appreciated.


--
Nisha P

  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 2,480
Default Macro

Hi

There is no need for a macro to achieve what you want.
just include another IF clause, testing against your selection of X.
I used Cell A1 to either hold X or not

=IF(A1="X",
IF(D12461500,25,
IF(D12461000,20,
IF(D1246500,15,10))),
IF(D1247300,15,
IF(D1247100,12,10)))
-(J1246+K1246)

I have split the formula on each IF so you can read it more clearly, and to
prevent the newsreader from breaking it in strange places. It is all one
long formula really.

Note that I have removed the " " around your values. As you had the
formula, it would place text values in the cell, which when you try to
deduct (J1246+K1246) at the end, would produce a #VALUE result.
Format the cell as Currency $ if you wish it to show as Dollar amounts

--
Regards
Roger Govier

"nishkrish" wrote in message
...
Hi i need to write a macro and have no idea how to do it if some one can
show
me form scratch

Ihave different formalus in different column which calculate commission
for
agent
Eg : if(d1247300,"$15",if(d1247100,"$12","$10"))-(j1247+k1247)

=IF(D12461500,"$25",IF(D12461000,"$20",IF(D1246 500,"$15","10")))-(J1246+K1246)

this 2 different formula in same column

i want to write a macro so i dont have to use two different formula when i
say certain column is X then its should run 1st formula if i select "y" it
should run 2nd formula.

Any help is appreciated.


--
Nisha P


  #5   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 31
Default Macro


Roger

this cannot work for since it has to 2 formulas if a= x then 1st formula
should run and if a=y then 2nd formula should run.


--
Nisha P


"Roger Govier" wrote:

Hi

There is no need for a macro to achieve what you want.
just include another IF clause, testing against your selection of X.
I used Cell A1 to either hold X or not

=IF(A1="X",
IF(D12461500,25,
IF(D12461000,20,
IF(D1246500,15,10))),
IF(D1247300,15,
IF(D1247100,12,10)))
-(J1246+K1246)

I have split the formula on each IF so you can read it more clearly, and to
prevent the newsreader from breaking it in strange places. It is all one
long formula really.

Note that I have removed the " " around your values. As you had the
formula, it would place text values in the cell, which when you try to
deduct (J1246+K1246) at the end, would produce a #VALUE result.
Format the cell as Currency $ if you wish it to show as Dollar amounts

--
Regards
Roger Govier

"nishkrish" wrote in message
...
Hi i need to write a macro and have no idea how to do it if some one can
show
me form scratch

Ihave different formalus in different column which calculate commission
for
agent
Eg : if(d1247300,"$15",if(d1247100,"$12","$10"))-(j1247+k1247)

=IF(D12461500,"$25",IF(D12461000,"$20",IF(D1246 500,"$15","10")))-(J1246+K1246)

this 2 different formula in same column

i want to write a macro so i dont have to use two different formula when i
say certain column is X then its should run 1st formula if i select "y" it
should run 2nd formula.

Any help is appreciated.


--
Nisha P




  #6   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 2,480
Default Macro

Hi
Sorry, typo with row numbers

=IF(A1="X",
IF(D12461500,25,
IF(D12461000,20,
IF(D1246500,15,10))),
IF(D1246300,15,
IF(D1246100,12,10)))
-(J1246+K1246)

It does run 2 different formulae.
If A1 = X then
IF(D12461500,25,
IF(D12461000,20,
IF(D1246500,15,10)))

Else if A1 <"X" then
IF(D1246300,15,
IF(D1246100,12,10))

In both cases take the following from the result
-(J1246+K1246)

If you want a situation where A1 could hold something other than X or Y,
then you could modify the formula to
=IF(A1="X",
IF(D12461500,25,
IF(D12461000,20,
IF(D1246500,15,10))),
IF(A1="Y",
IF(D1246300,15,
IF(D1246100,12,10)),0))
-(J1246+K1246)

In which case if A1 was neither X nor Y, the only part of the formula that
would be invoked would be
-(J1246+K1246)
--
Regards
Roger Govier

"nishkrish" wrote in message
...

Roger

this cannot work for since it has to 2 formulas if a= x then 1st formula
should run and if a=y then 2nd formula should run.


--
Nisha P


"Roger Govier" wrote:

Hi

There is no need for a macro to achieve what you want.
just include another IF clause, testing against your selection of X.
I used Cell A1 to either hold X or not

=IF(A1="X",
IF(D12461500,25,
IF(D12461000,20,
IF(D1246500,15,10))),
IF(D1247300,15,
IF(D1247100,12,10)))
-(J1246+K1246)

I have split the formula on each IF so you can read it more clearly, and
to
prevent the newsreader from breaking it in strange places. It is all one
long formula really.

Note that I have removed the " " around your values. As you had the
formula, it would place text values in the cell, which when you try to
deduct (J1246+K1246) at the end, would produce a #VALUE result.
Format the cell as Currency $ if you wish it to show as Dollar amounts

--
Regards
Roger Govier

"nishkrish" wrote in message
...
Hi i need to write a macro and have no idea how to do it if some one
can
show
me form scratch

Ihave different formalus in different column which calculate commission
for
agent
Eg : if(d1247300,"$15",if(d1247100,"$12","$10"))-(j1247+k1247)

=IF(D12461500,"$25",IF(D12461000,"$20",IF(D1246 500,"$15","10")))-(J1246+K1246)

this 2 different formula in same column

i want to write a macro so i dont have to use two different formula
when i
say certain column is X then its should run 1st formula if i select "y"
it
should run 2nd formula.

Any help is appreciated.


--
Nisha P


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
need help to update macro to office 2007 macro enabled workbook jatman Excel Discussion (Misc queries) 1 December 14th 07 01:57 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM


All times are GMT +1. The time now is 04:16 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"