Search cell and return value in other cell from other worksheet

Gylle

New Member
Joined
Apr 10, 2022
Messages
47
Office Version
  1. 365
Platform
  1. Windows
Hi all

I will try to explain as good as posible :)

I have a woorksheet, let's call it 'january', where I make entries in colomn C3 C4 C5 etc
I whould like a value to return in column D3 D4 D5 etc
The value in D cells should come from a shearch from an other worksheet, let's call the 'database'

The 'database' i whould like to look like this:
B2 cell is called Pork, C2 cell is called Beef, D2 cell is called Fish
In column B i can then write all sorts of products/words refering to pork
In column C i can then write all sorts of products/words refering to beef
In column D i can then write all sorts of products/words refering to fish

So now I whould like to search 'january' worksheet C3 to see if any words from either column B C or D from range 2 to infinty in worksheet 'database' is present.
If so the value from cell 2 in 'database' either B C D is then returned in cell D3 in worksheet 'january'

so baslic cell D3 in 'january' search C3 in 'january' for words contained in either B C D in 'database' and return the value from the 'database' coulmn cell B2, C2 or D2 where the word is found.

Photo of 'database' included

The goal is that the 'database' file is a live thing that i can keep adding to so it keeps growing.

I started with nested IF but realized it was not smart and to much work to update.

Thanks for the help :)
 

Attachments

  • Skærmbillede 2022-04-20 195816.png
    Skærmbillede 2022-04-20 195816.png
    7.4 KB · Views: 16

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
I got lost here:
You said:
If so the value from cell 2 in 'database' either B C D is then returned in cell D3 in worksheet 'january'

So only one value will be returned to sheet named "January" ??
And how will the script be activated?
By clicking a button or entering a value in sheet "January" Range

And you said:
B2 cell is called Pork, C2 cell is called Beef, D2 cell is called Fish

called??
Do you mean is named "Pork"

Give me a example with a image of both sheets
 
Upvote 0
I got lost here:
You said:
If so the value from cell 2 in 'database' either B C D is then returned in cell D3 in worksheet 'january'

So only one value will be returned to sheet named "January" ??
And how will the script be activated?
By clicking a button or entering a value in sheet "January" Range

And you said:
B2 cell is called Pork, C2 cell is called Beef, D2 cell is called Fish

called??
Do you mean is named "Pork"

Give me a example with a image of both sheets
Yes only one value should return to worksheet 'january'
I been trying to figure out if it could be done with IF or LOOKUP
But baslic it whould always be active as soon as i whould enter a value in the B cloumn in 'january'
sort of like this:
=IF(AND(ISNUMBER(SEARCH("ham",B2)),ISNUMBER(SEARCH("Tail",B2))),"Pork","Data missing")
But as soon as i try to add more words it gets heavy and way to long to maintain as it should search the same things over and over again in a large number of cells in 'january'
further more i ran into a wall when i needed more then one outcome for instance if it was beef insted of pork or fish



Database.xlsx
ABCDE
1
2PorkBeefFish
3HamRoastbeefLing
4RoastRibeyeHerring
5
6
7
8
9
10
Database


January.xlsx
ABCDE
1Week 1
2WarmHam with potatoes and carrots<---C2 should search worksheet 'database' column B, C and D from range 3 in all tree columns to infinity for words that are accuring in B2 in this (january) worksheet. So in this instance C2 in 'january' worksheet should return the word 'Pork' as ham is written in B2 here and is accuring in cloumn B in worksheet 'database'. It should return 'Pork' as B2 is the value from that column.
3VeggetarianFalaffel with pico de galio
4SoupGarlic soup
5
6Week 2
7WarmRoastbeef with crisp onions<---C7 should return 'Beef' as roastbeef is accuring in 'database' worksheet column C, and column C is named 'beef' in C2 in 'database' worksheet.
8Veggetariantortillian with salat and hummus
9SoupBroccoli soup with croutons
10
11Week 3
12Warm<---C12 should return 'data missing as B12 has no entered value yet.
13Veggetarian
14Soup
15
January
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top