+ Reply to Thread
Results 1 to 9 of 9

Lookup month and calculate if specific month value apply

  1. #1
    Forum Contributor
    Join Date
    07-05-2012
    Location
    Stockholm
    MS-Off Ver
    Excel 2010
    Posts
    162

    Lookup month and calculate if specific month value apply

    Hi guys,
    I've got a bit of a problem. I'm using a sheet to calculate cost based on hours, hourly cost and a few other values.

    What I aim to do is to create a formula that checks if D5:BD5 has a certain month value, only specificFormula based on months.xlsx columns included in that month should be included in the calculation. So for example,

    The formula in D23 should have something that says that the columns D5:BD5 that are "january" should be the only ones used in the calculation. So some sort of IF or LOOKUP function I guess?

    Any ideas?

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Lookup month and calculate if specific month value apply

    If you make row 4 (E4:BD4) not have any blanks, put the month name in each and every cell..
    I.E...
    JAN JAN JAN FEB FEB FEB etc..
    insted of
    JAN blank blank Feb Blank Blank etc..

    Then you can use this in D23 and filled down/right
    =SUMPRODUCT(($C$9:$C$12=$B23)*($B$9:$B$12)*($E$4:$BD$4=D$20)*$E$9:$BD$12)

  3. #3
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Lookup month and calculate if specific month value apply

    hi D-Smoke, a variation of Jonmo's formula:
    =SUMPRODUCT(($C$9:$C$12=$B23)*($B$9:$B$12)*(TEXT($E$5:$BD$5,"mmm")=D$20)*$E$9:$BD$12)

    don't have to worry about blanks

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Lookup month and calculate if specific month value apply

    Quote Originally Posted by benishiryo View Post
    hi D-Smoke, a variation of Jonmo's formula:
    =SUMPRODUCT(($C$9:$C$12=$B23)*($B$9:$B$12)*(TEXT($E$5:$BD$5,"mmm")=D$20)*$E$9:$BD$12)

    don't have to worry about blanks
    Nice, I didn't even notice those were dates in row 5. They looked like just random numbers to me

  5. #5
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Lookup month and calculate if specific month value apply

    @Jonmo:

    yeah i noticed a formula there & checked it out. simply took the convenient way of adapting your formula. =)

  6. #6
    Forum Contributor
    Join Date
    07-05-2012
    Location
    Stockholm
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: Lookup month and calculate if specific month value apply

    Hi,
    Thanks to the both of you for your kind help. I used benishiryo's formula since it refers to the dates in row 5. When I apply the formula to the sheet I attached it works fine, but when I try it on my original file I get a "VALUE" error. I've tried to find out why but can't get my head around it.

    Perhaps it's hard to see an error if I just paste it here, but if you see something that is incorrect please let me know.

    =SUMPRODUCT('Budget (w. plan)'!D10:D20=B39)*('Budget (w. plan)'!C10:C19)*(TEXT('Budget (w. plan)'!E6:BE6;"mmm")=D36)*'Budget (w. plan)'!E10:BE19

    Thanks!
    Last edited by D-smoke; 06-23-2013 at 06:23 PM.

  7. #7
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Lookup month and calculate if specific month value apply

    Use consistenet ranges, hence

    =SUMPRODUCT('Budget (w. plan)'!D10:D19=B39)*('Budget (w. plan)'!C10:C19)*(TEXT('Budget (w. plan)'!E6:BE6;"mmm")=D36)*'Budget (w. plan)'!E10:BE19
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  8. #8
    Forum Contributor
    Join Date
    07-05-2012
    Location
    Stockholm
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: Lookup month and calculate if specific month value apply

    Hi ACE_XL,
    I changed the ranges as you suggest, but I still get the "VALUE" error? Any thoughts of why this could be?

    Cheers!

  9. #9
    Forum Contributor
    Join Date
    07-05-2012
    Location
    Stockholm
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: Lookup month and calculate if specific month value apply

    Hi!

    I finally managed to find the error my self. It was the placement of the parenthesis. So thanks guys for your great help! I will add to your rep!
    Cheers!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1