CSE formula with index/match

Faller

New Member
Joined
Jul 22, 2011
Messages
7
I am trying to index/match to find numbers based off of words in an array formula but when I do the match part always returns the first number it sees. So I'm only effectively adding a count multiplier.

My formula is:
{=SUM(IF(B2:J2="",0,INDEX(Food:Calories,MATCH(Calendar!B2:J2,Food,0),2)))}

I'm trying to type in what I eat in a day and have it spit out how many calories I've eaten in a day. But it always pulls from the first thing I've eaten that day and multiplies it by how many entries I put in for the day.

Thank you
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Have a look at this example:

Excel Workbook
ABCD
1FoodCaloriesCalendar
2Mush100More
3Stuff101Apple
4Whatever102Lemonade
5More103
6Less104320
7Dunno105
8Donuts106
9Apple107
10Banana108
11Melon109
12Lemonade110
Sheet19
 
Upvote 0
Have a look at this example:

Excel Workbook
ABCD
1FoodCaloriesCalendar
2Mush100More
3Stuff101Apple
4Whatever102Lemonade
5More103
6Less104320
7Dunno105
8Donuts106
9Apple107
10Banana108
11Melon109
12Lemonade110
Sheet19
Avoid the "whatever" at all cost! :rofl:

On a side note...

I notice a lot of folks do this reverse logic thing:

...NOT(ISNA(MATCH(...

Why not just:

...ISNUMBER(MATCH(...
 
Upvote 0
Avoid the "whatever" at all cost! :rofl:

On a side note...

I notice a lot of folks do this reverse logic thing:

...NOT(ISNA(MATCH(...

Why not just:

...ISNUMBER(MATCH(...
Ha ha, you noticed my weird foodstuffs then. :-D

As for the NOT(ISNA ... I learned to do it that way a long long time ago, and just do it automatically when I need it. I think that may true for a lot of other long time users.
 
Upvote 0
I got that part (My name was not set to the right range). It gives me a problem if I eat something twice in a day. It skips it. I assume it only looks for the first instance since the lookup value is my food.
 
Upvote 0
Ah, I didn't know that you'd have things twice a day. Have a look at this ... the ranges have changed subtly, and there is a dummy 0 at the end of the Food/Calorie list:

Excel Workbook
ABCD
1FoodCalories*Calendar
2Mush100*More
3Stuff101*Apple
4Whatever102*Lemonade
5More103*Apple
6Less104**
7Dunno105**
8Donuts106**
9Apple107**
10Banana108**
11Melon109**
12Lemonade110*427
13dummy0**
Example


Defined names are:

Excel Workbook
AB
15CalAndDummy=Example!$B$2:$B$13
16Calories=Example!$B$2:$B$12
17Food=Example!$A$2:$A$12
18FoodAndTitle=Example!$A$1:$A$12
Example
 
Last edited:
Upvote 0
For the life of me I can't get this to work. I've checked over my naming and can't seem to find anything wrong or different with the formula other than my match range (B2:J2). I've transposed it to see if it had to be vertical but that doesn't seem to be the case.

Any help, and the help already given, is appreciated.

Vince
 
Upvote 0
Post your formula and describe what is in each referenced range.
 
Upvote 0
=SUMPRODUCT(FREQUENCY(MATCH(B2:J2,FoodAndTitle,0),ROW(Calories))*CalAndDummy)

CalAndDummy =Values!$B$2:$B$13
Calories =Values!$B$2:$B$12
Food =Values!$A$2:$A$12
FoodAndTitle =Values!$A$1:$A$12

It lines up almost exactly by chance.

Don't know where I'm going wrong.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,834
Members
452,947
Latest member
Gerry_F

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