Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Using VLOOKUP and "AND" together

I have a worksheet that looks like this:

A B C D E F G
...............................
Date --- Line --- --- --- Value

01-Jan-08 ---- MR1 200
01-Jan-08 ---- MR1 100
01-Jan-08 ---- MR2 50
01-Jan-08 ---- MR2 75
01-Jan-08 ---- MR2 125

This is a very large database with four different (C column) types per date
and each type may have 1-6 entries. I want to be able to lookup the date and
sum the values for each C column type.

Can anyone help please?

N.B. The columns which are blank have info, however I don't need that info
right now.
Mike
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Using VLOOKUP and "AND" together

Put the date of interest in, say, i2, and this formula in J2:

=SUMPRODUCT((A$1:A$1000=i$2)*(C$1:C$1000="MR1")*(G $1:G$1000))

to give you a sum of the MR1 entries for that date. I've assumed that
you have 1000 rows of data, but adjust this if you have more. You can
copy the formula down and just change the "MR1" bit as appropriate for
the other Line values, or you could put the line values in H2 to H7,
say, and change the formula to this:

=SUMPRODUCT((A$1:A$1000=i$2)*(C$1:C$1000=H2)*(G$1: G$1000))

and then copy down.

Hope this helps.

Pete

On May 16, 7:42*pm, chocoman
wrote:
I have a worksheet that looks like this:

A * * * * * * * * * * * B * * * *C * * * *D * * * E * * * F * * *G * *
..............................
Date * * * * * * * * --- * * *Line * *--- * * *--- * * --- * * Value

01-Jan-08 * * * * ---- * * MR1 * * * * * * * * * * * * * * * 200
01-Jan-08 * * * * ---- * * MR1 * * * * * * * * * * * * * * * 100
01-Jan-08 * * * * ---- * * MR2 * * * * * * * * * * * * * * * *50
01-Jan-08 * * * * ---- * * MR2 * * * * * * * * * * * * * * * *75
01-Jan-08 * * * * ---- * * MR2 * * * * * * * * * * * * * * * 125

This is a very large database with four different (C column) types per date
and each type may have 1-6 entries. I want to be able to lookup the date and
sum the values for each C column type.

Can anyone help please?

N.B. The columns which are blank have info, however I don't need that info
right now.
*Mike


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Using VLOOKUP and "AND" together

Thank you Pete. It worked perfectly. Now, I would like to tally the same
results per week. Is it possible to nest a total in one formula?

Date --- Line --- --- --- Value

01-Jan-08 ---- MR1 200
01-Jan-08 ---- MR1 100
01-Jan-08 ---- MR2 50
01-Jan-08 ---- MR2 75
01-Jan-08 ---- MR2 125
02-Jan-08 ---- MR1 50
02-Jan-08 ---- MR2 75
02-Jan-08 ---- MR2 125

I want to look up 01-Jan-08 to 31-Jan-08 for MR2, it should give me:
50+75+125+75+125=450
Is it possible or am I dreaming?

"Pete_UK" wrote:

Put the date of interest in, say, i2, and this formula in J2:

=SUMPRODUCT((A$1:A$1000=i$2)*(C$1:C$1000="MR1")*(G $1:G$1000))

to give you a sum of the MR1 entries for that date. I've assumed that
you have 1000 rows of data, but adjust this if you have more. You can
copy the formula down and just change the "MR1" bit as appropriate for
the other Line values, or you could put the line values in H2 to H7,
say, and change the formula to this:

=SUMPRODUCT((A$1:A$1000=i$2)*(C$1:C$1000=H2)*(G$1: G$1000))

and then copy down.

Hope this helps.

Pete

On May 16, 7:42 pm, chocoman
wrote:
I have a worksheet that looks like this:

A B C D E F G
..............................
Date --- Line --- --- --- Value

01-Jan-08 ---- MR1 200
01-Jan-08 ---- MR1 100
01-Jan-08 ---- MR2 50
01-Jan-08 ---- MR2 75
01-Jan-08 ---- MR2 125

This is a very large database with four different (C column) types per date
and each type may have 1-6 entries. I want to be able to lookup the date and
sum the values for each C column type.

Can anyone help please?

N.B. The columns which are blank have info, however I don't need that info
right now.
Mike



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Using VLOOKUP and "AND" together

You say you want to do it for a week, and then say you want it for
January. If the latter, then you can do this:

=SUMPRODUCT((MONTH(A$1:A$1000)=MONTH(i$2))*(C$1:C$ 1000=H2)*(G$1:G
$1000))

i.e. for the month of the date in i2, or if you want to do it for one
week (7 days) from the date in i2, you can do it this way:

=SUMPRODUCT((A$1:A$1000=i$2)*(A$1:A$1000<=i$2+7)* (C$1:C$1000=H2)*(G
$1:G$1000))

Hope this helps.

Pete



On May 17, 12:27*pm, chocoman
wrote:
Thank you Pete. It worked perfectly. Now, I would like to tally the same
results per week. Is it possible to nest a total in one formula?

*Date * * * * * * *--- * * *Line * *--- * * *--- * * --- * * Value

01-Jan-08 * * * * ---- * * MR1 * * * * * * * * * * * * * * * 200
01-Jan-08 * * * * ---- * * MR1 * * * * * * * * * * * * * * * 100
01-Jan-08 * * * * ---- * * MR2 * * * * * * * * * * * * * * * *50
01-Jan-08 * * * * ---- * * MR2 * * * * * * * * * * * * * * * *75
01-Jan-08 * * * * ---- * * MR2 * * * * * * * * * * * * * * * 125
02-Jan-08 * * * * ---- * * MR1 * * * * * * * * * * * * * * * *50
02-Jan-08 * * * * ---- * * MR2 * * * * * * * * * * * * * * * *75
02-Jan-08 * * * * ---- * * MR2 * * * * * * * * * * * * * * * 125

I want to look up 01-Jan-08 to 31-Jan-08 for MR2, it should give me:
50+75+125+75+125=450
Is it possible or am I dreaming?



"Pete_UK" wrote:
Put the date of interest in, say, i2, and this formula in J2:


=SUMPRODUCT((A$1:A$1000=i$2)*(C$1:C$1000="MR1")*(G $1:G$1000))


to give you a sum of the MR1 entries for that date. I've assumed that
you have 1000 rows of data, but adjust this if you have more. You can
copy the formula down and just change the "MR1" bit as appropriate for
the other Line values, or you could put the line values in H2 to H7,
say, and change the formula to this:


=SUMPRODUCT((A$1:A$1000=i$2)*(C$1:C$1000=H2)*(G$1: G$1000))


and then copy down.


Hope this helps.


Pete


On May 16, 7:42 pm, chocoman
wrote:
I have a worksheet that looks like this:


A * * * * * * * * * * * B * * * *C * * * *D * * * E * * * F * * *G * *
..............................
Date * * * * * * * * --- * * *Line * *--- * * *--- * * --- * * Value


01-Jan-08 * * * * ---- * * MR1 * * * * * * * * * * * * * * * 200
01-Jan-08 * * * * ---- * * MR1 * * * * * * * * * * * * * * * 100
01-Jan-08 * * * * ---- * * MR2 * * * * * * * * * * * * * * * *50
01-Jan-08 * * * * ---- * * MR2 * * * * * * * * * * * * * * * *75
01-Jan-08 * * * * ---- * * MR2 * * * * * * * * * * * * * * * 125


This is a very large database with four different (C column) types per date
and each type may have 1-6 entries. I want to be able to lookup the date and
sum the values for each C column type.


Can anyone help please?


N.B. The columns which are blank have info, however I don't need that info
right now.
*Mike- Hide quoted text -


- Show quoted text -


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Using VLOOKUP and "AND" together

Thanks again Pete. I tallied it by week, period and year. It worked
fantabulously!!!

Cheers

"Pete_UK" wrote:

You say you want to do it for a week, and then say you want it for
January. If the latter, then you can do this:

=SUMPRODUCT((MONTH(A$1:A$1000)=MONTH(i$2))*(C$1:C$ 1000=H2)*(G$1:G
$1000))

i.e. for the month of the date in i2, or if you want to do it for one
week (7 days) from the date in i2, you can do it this way:

=SUMPRODUCT((A$1:A$1000=i$2)*(A$1:A$1000<=i$2+7)* (C$1:C$1000=H2)*(G
$1:G$1000))

Hope this helps.

Pete



On May 17, 12:27 pm, chocoman
wrote:
Thank you Pete. It worked perfectly. Now, I would like to tally the same
results per week. Is it possible to nest a total in one formula?

Date --- Line --- --- --- Value

01-Jan-08 ---- MR1 200
01-Jan-08 ---- MR1 100
01-Jan-08 ---- MR2 50
01-Jan-08 ---- MR2 75
01-Jan-08 ---- MR2 125
02-Jan-08 ---- MR1 50
02-Jan-08 ---- MR2 75
02-Jan-08 ---- MR2 125

I want to look up 01-Jan-08 to 31-Jan-08 for MR2, it should give me:
50+75+125+75+125=450
Is it possible or am I dreaming?



"Pete_UK" wrote:
Put the date of interest in, say, i2, and this formula in J2:


=SUMPRODUCT((A$1:A$1000=i$2)*(C$1:C$1000="MR1")*(G $1:G$1000))


to give you a sum of the MR1 entries for that date. I've assumed that
you have 1000 rows of data, but adjust this if you have more. You can
copy the formula down and just change the "MR1" bit as appropriate for
the other Line values, or you could put the line values in H2 to H7,
say, and change the formula to this:


=SUMPRODUCT((A$1:A$1000=i$2)*(C$1:C$1000=H2)*(G$1: G$1000))


and then copy down.


Hope this helps.


Pete


On May 16, 7:42 pm, chocoman
wrote:
I have a worksheet that looks like this:


A B C D E F G
..............................
Date --- Line --- --- --- Value


01-Jan-08 ---- MR1 200
01-Jan-08 ---- MR1 100
01-Jan-08 ---- MR2 50
01-Jan-08 ---- MR2 75
01-Jan-08 ---- MR2 125


This is a very large database with four different (C column) types per date
and each type may have 1-6 entries. I want to be able to lookup the date and
sum the values for each C column type.


Can anyone help please?


N.B. The columns which are blank have info, however I don't need that info
right now.
Mike- Hide quoted text -


- Show quoted text -





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Using VLOOKUP and "AND" together

Good to hear that, Mike - thanks for feeding back and letting me know.

Pete

On May 17, 8:11*pm, chocoman
wrote:
Thanks again Pete. I tallied it by week, period and year. It worked
fantabulously!!!

Cheers

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining "IF"statement with "Vlookup" Malcolm McMaster[_2_] Excel Discussion (Misc queries) 9 October 21st 14 03:13 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
How to replace "#N/A" w "0"when vlookup couldn't find the match? Holly Excel Discussion (Misc queries) 2 July 17th 06 11:48 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


All times are GMT +1. The time now is 03:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"