if column contains certain value, display value from adjacent cell

I have a list of food in my freezer and in another sheet I have a planning of when I'm gonna use up what, because I will be moving soon and I need my freezer to be empty by then 🙂


So in the list sheet, column A contains the names of the food. In column B I wrote the date of when I will use it.

The planning sheet has columns with the date and I want the food to automatically come in there.


What I have been trying is, for instance under monday april 5th 2015:

IF(CONTENT :: B=DATE(2015;4;6);CONTENT :: A;"none")


This just results in "none", no matter if there actually is an entry in that B-column with the correct date.


When I tried to select the cell myself

IF(CONTENT :: B27=DATE(2015;4;6);CONTENT :: A27;"none")

Then of course I actually got the name of the food that was entered in A27 as a result.


So I somehow need to be able to adapt the first formula, so that it knows that I need it to search the B-column for the entry that has the correct date and then as a result show me the entry of the cell in the A-column with the same row-number.


I hope any of this makes sense.

Thanks in advance.


Btw I use numbers '09 version 2.3 (554)

Posted on Apr 4, 2015 5:36 AM

Reply
4 replies

Apr 6, 2015 11:51 PM in response to Katinkaw

I need it to search the B-column for the entry that has the correct date and then as a result show me the entry of the cell in the A-column with the same row-number.


You can do that with a the INDEX MATCH combination, something like this:


User uploaded file


In Numbers 2 the formula would be like this:


=INDEX(Contents::$A,MATCH(A2,Contents::$B,0))


You would replace the , with ; as needed for your localization.


Note that the way Numbers deals with dates can sometimes prevent a matches when you expect one. That's because Numbers always stores a true date as a date-time string and the time component is often hidden by the cell formatting. Here, since I didn't need to do any date arithmetic, I avoided any possible complications by entering the "dates" as true strings by first typing a ' and then a "date" exactly as shown. That's why the "dates" in the screenshot are left-justified.


SG

Apr 4, 2015 8:07 AM in response to Katinkaw

Hi Katinkaw,


Here is an approach that uses an index column in each table to create a unique value to search for. Once set up these columns can be hidden. For my tables I am imagining you only expect 3 items for each date. If you want more, add more. You can hide the error messages and hide the unneeded rows by displaying only rows in column B that are not blank with the reorganize menu.

User uploaded file

C2 =YEARFRAC("1/1/2015",A2,)+COUNTIF(A$2:A2,A2)

This formula is the same in each table and is filled down. It adds the number of times a date appears in the list to the fraction of the year that date represents.


Then we search for that number in our other table.

User uploaded file

B2 =INDEX(Planning::B$1:B$10,MATCH(C2,Planning::index,0),1,)

This is filled down.

My table looks different because I filtered it to only show rows with values in column B. If I added a bag of cherries to the planning table it would show up if there was a date match.


Let me know if you have any questions.


quinn

Apr 6, 2015 11:57 PM in response to SGIII

Thanks, that really helped me.

I was wondering though if I could add an extra factor to this. I added a column to my first sheet, which states who in my family is gonna eat the food. So now a row in that sheet might be

A: lamb chops

B: april 10th

C: mom


On the planning sheet the colums have the dates and then there's a row for each member of the family.

So I would like for the "lamb chops" to pop in the column of april 10th, but in the row of "mom". Is that possible?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

if column contains certain value, display value from adjacent cell

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.