Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MMH MMH is offline
external usenet poster
 
Posts: 14
Default Vary formula based on what another cell contains

Hello

I have a spreadsheet where I would like to create a formula that says:

If cell.Offset(0, -2) contains "with GST", then formula = "cell.Offset(0,
-1)/8".
Elseif cell.Offset(0, -2) contains "without GST", then formula = "0"
Elseif cell.Offset(0, -2) contains "ZR", then formula = "0"

I'm not sure how to write the formula to look for something *contained* in
the target cell, rather than checking the entire cell contents. Any help
would be greatly appreciated.

Thanks
MMH
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Vary formula based on what another cell contains

the operator is "Like"

* = none or many characters
? = exactly one char

"toto" Like "*ot*" is true

find more details in the vba help, but the idea is to use
T$ Like "*wanted*"

and this will be true since wanted is include in T
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 303
Default Vary formula based on what another cell contains

Whether the cell contains "without" or "ZR" the result is the same.
So I hope that the term "with GST" is at the and of the cell.
Then the following formula will work.

=IF(RIGHT(A1,8)="with GST",B1/9,0)

Seen the lack of other responses I presume it is hard to check for any
containment.

--
Greetings from New Zealand
Bill K
"MMH" wrote in message
...
Hello

I have a spreadsheet where I would like to create a formula that says:

If cell.Offset(0, -2) contains "with GST", then formula = "cell.Offset(0,
-1)/8".
Elseif cell.Offset(0, -2) contains "without GST", then formula = "0"
Elseif cell.Offset(0, -2) contains "ZR", then formula = "0"

I'm not sure how to write the formula to look for something *contained* in
the target cell, rather than checking the entire cell contents. Any help
would be greatly appreciated.

Thanks
MMH



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 303
Default Vary formula based on what another cell contains

Oops,

I have always worked with the divide by 9 in stead of 8 to find the amount
of gst out of a gross amount.
Your example showed divide by 8.
Greetings
Bill K

"Bill Kuunders" wrote in message
...
Whether the cell contains "without" or "ZR" the result is the same.
So I hope that the term "with GST" is at the and of the cell.
Then the following formula will work.

=IF(RIGHT(A1,8)="with GST",B1/9,0)

Seen the lack of other responses I presume it is hard to check for any
containment.

--
Greetings from New Zealand
Bill K
"MMH" wrote in message
...
Hello

I have a spreadsheet where I would like to create a formula that says:

If cell.Offset(0, -2) contains "with GST", then formula = "cell.Offset(0,
-1)/8".
Elseif cell.Offset(0, -2) contains "without GST", then formula = "0"
Elseif cell.Offset(0, -2) contains "ZR", then formula = "0"

I'm not sure how to write the formula to look for something *contained*
in
the target cell, rather than checking the entire cell contents. Any help
would be greatly appreciated.

Thanks
MMH





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
Vary Color based on value Jennifer Charts and Charting in Excel 3 January 6th 09 05:50 PM
correlation when the cell references vary Mark[_3_] Excel Worksheet Functions 0 July 31st 07 07:07 AM
how to vary cell name in formula Megan BDI Excel Worksheet Functions 6 April 25th 07 09:07 PM
vary the vlookup array depending on the value in a cell Greg Bergin Excel Worksheet Functions 1 June 14th 06 08:58 AM
Vary variables in a formula via reference to another cell Peter Excel Discussion (Misc queries) 2 July 21st 05 07:19 PM


All times are GMT +1. The time now is 11:32 PM.

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

About Us

"It's about Microsoft Excel"