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
 
The contents of B2 to J2 must contain only items that match cells in the Food area ( and I mean no blank cells either ). Double check that.

Example of using dynamic range definition for Calendar:

Excel Workbook
BCDEF
2MoreAppleLemonade
3320
4
5CalAndDummy=Values!$B$2:$B$13
6Calendar=OFFSET(Sheet1!$B$2,0,0,1,COUNTA(Sheet1!$2:$2))
7Calories=Values!$B$2:$B$12
8Food=Values!$A$2:$A$12
9FoodAndTitle=Values!$A$1:$A$12
Sheet1
 
Last edited:
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Worked like a charm. Just put an X for blanks and made it 0 calories.
I have no idea how this formula works but I guess I now have some learning to do.

Thank you kindly
Vince
 
Upvote 0
Worked like a charm. Just put an X for blanks and made it 0 calories.
I have no idea how this formula works but I guess I now have some learning to do.

Thank you kindly
Vince

That's one way to get it working. I've amended my last entry to show how to do it with a dynamically defined named range that calculates how many entries to use, which may be of use.

Good luck! :-D
 
Upvote 0
Also, here's a breakdown of the formula to help you with your learning:

Excel Workbook
ABCDEFGHIJKL
1FoodCaloriesCalendarMATCH(D2:D5,FoodAndTitle,0)ROW(Calories)FREQUENCY(MATCH(D2:D5,FoodAndTitle,0),ROW(Calories))CalAndDummyMultiply
2Mush100More5201000
3Stuff101Apple9301010
4Whatever102Lemonade12401020
5More103Apple951103103
6Less104601040
7Dunno105701050
8Donuts106801060
9Apple10792107214
10Banana1081001080
11Melon1091101090
12Lemonade110Result121110110
13dummy0427000
14Final result ========>>>427
Values
 
Upvote 0

Forum statistics

Threads
1,225,155
Messages
6,183,211
Members
453,151
Latest member
Lizamaison

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