LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Dan
 
Posts: n/a
Default

If you are using Access, I would assume you are more using a table.

Follow SQL could do.
SELECT
CASE
WHEN x like '%apples%" THEN "apples"
WHEN x like '%oranges%" THEN "orange"
ELSE
""
FROM
table list


"jhicsupt" wrote:

This worked perfectly. Now another question -- do you know how I would put
this in an Access query?

I am using Excel to run the query, but after thinking, would rather do it
right in Access and let it come over from the query. Or should I post this
question on the Access group?

"Biff" wrote:

Well, that's a whole different animal!

Try this:

=IF(ISNUMBER(SEARCH("apples",A2)),"apples",IF(ISNU MBER(SEARCH("oranges",A2)),"oranges",""))

What if it's "apples or oranges" or "oranges or apples" ?

You'd be better off using a cell to hold the criteria:

A1 = apples
B1 = oranges

=IF(ISNUMBER(SEARCH(A1,A2)),A1,IF(ISNUMBER(SEARCH( B1,A2)),B1,""))

Biff

"jhicsupt" wrote in message
...
In cell A2, it could be "apples and pears" or it could be "oranges and
pears". What I want to do is in cell B2, just return either "apples" or
"oranges", disregarding the "and pears".

How would I do that?

Thanks for the quick response.

"Biff" wrote:

Hi!

Try one of these:

=IF(OR(A2={"apples","oranges"}),A2,"")

Biff

"jhicsupt" wrote in message
...
I would like to return a value if criteria is met.

If A2 contains the word "apples", then in cell B2, write "apples".
If A2 contains the word "oranges, then in cell B2, write "oranges".
If A2 does not contain the words "apples" or "oranges", leave the cell
blank.

Can you help me with a formula for this?

Thanks in advance.






 
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
return a cell contents as the result of usiing "small" KFEagle Excel Worksheet Functions 1 September 10th 05 08:33 PM
if the value of a cell in a range is not blank, then return the v. kvail Excel Worksheet Functions 2 April 8th 05 10:07 PM
Syntax for inferred cell references donesquire Excel Worksheet Functions 4 April 4th 05 09:29 PM
Function to determine if any cell in a range is contained in a given cell [email protected] Excel Worksheet Functions 3 February 7th 05 04:19 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 04:12 PM.

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"