Excel formula help please!
Discussion
I'm a bit rusty on Excel - could anyone help me with the following?
I have two columns in a worksheet - dates and costs, and I want to be able to sum the costs between two dates, how would I do this?
Example:
Date Cost
01/04/2007 £395
21/06/2006 £295
23/08/2007 £450
10/02/2007 £395
11/11/2006 £195
23/02/2007 £450
14/04/2006 £595
21/08/2006 £235
23/06/2007 £420
I want someone to be able to input a date range "from" and "to" and have the cost between those dates. I want to be able to do this without sorting the data with respect to date - I'd like the list of dates and costs to be purely just a big wadge of data, and the results be available on a different worksheet by just banging in date ranges quickly and easily.
I know this is easier on Access, but this is only a small part of what the spreadsheet does, and I'd rather keep the whole thing in Excel.
any ideas?
I have two columns in a worksheet - dates and costs, and I want to be able to sum the costs between two dates, how would I do this?
Example:
Date Cost
01/04/2007 £395
21/06/2006 £295
23/08/2007 £450
10/02/2007 £395
11/11/2006 £195
23/02/2007 £450
14/04/2006 £595
21/08/2006 £235
23/06/2007 £420
I want someone to be able to input a date range "from" and "to" and have the cost between those dates. I want to be able to do this without sorting the data with respect to date - I'd like the list of dates and costs to be purely just a big wadge of data, and the results be available on a different worksheet by just banging in date ranges quickly and easily.
I know this is easier on Access, but this is only a small part of what the spreadsheet does, and I'd rather keep the whole thing in Excel.
any ideas?
How about this, not sure if this is what you mean but I created a macro where you enter the date into the cells as shown then hit CTRL+SHFT+K and the total should go into E5.
The code is simple and you should be able to change it to suit.
http://www.speed-shot.co.uk/sum1.xls
_
Stuart
The code is simple and you should be able to change it to suit.
http://www.speed-shot.co.uk/sum1.xls
_
Stuart
tigger1 said:
If you need to unsimplify it, feel free to ask the question in full - I'm sure I'll be able to help.
If you're "learning" excel functions, make sure that you know how to use VLOOKUP and SUMPRODUCT aswell. Two very useful little buggers there. SUMIF and COUNTIF are useful too though.
Thanks, I will do! I used to be a bit of a whizz with Excel, and I taught it when I was an IT Trainer. It's amazing how quickly the knowledge goes though - I can't even remember the SUMIF function. I'm looking forward to refreshing my memory!If you're "learning" excel functions, make sure that you know how to use VLOOKUP and SUMPRODUCT aswell. Two very useful little buggers there. SUMIF and COUNTIF are useful too though.
Another question if you don't mind and then I'll be done 
If I had this set of data:
A B
apples 3
pears 3
oranges 2
oranges 4
pears 3
apples 2
apples 4
oranges 1
oranges 4
There's no pattern, it's just a list of words and numbers.
How would I count how many times a given word appears with a given number? For example, "pears" appearing with a "3", or "oranges" appearing with a "4"?
COUNTIF seems to only do one range and one criteria, so I could count the oranges and the 4s, but not both together. SUMIF appears to be the same (using that would amount to the same thing, just dividing by four afterwards). VLOOKUP seems to stop once it's looked one thing up... This is so unbelievably easy to do in C++, it must be possible in Excel surely?

If I had this set of data:
A B
apples 3
pears 3
oranges 2
oranges 4
pears 3
apples 2
apples 4
oranges 1
oranges 4
There's no pattern, it's just a list of words and numbers.
How would I count how many times a given word appears with a given number? For example, "pears" appearing with a "3", or "oranges" appearing with a "4"?
COUNTIF seems to only do one range and one criteria, so I could count the oranges and the 4s, but not both together. SUMIF appears to be the same (using that would amount to the same thing, just dividing by four afterwards). VLOOKUP seems to stop once it's looked one thing up... This is so unbelievably easy to do in C++, it must be possible in Excel surely?
Given:
A B C
apples 3 apples3
pears 3 pears3
oranges 2 oranges2
oranges 4 oranges4
pears 3 etc etc
apples 2
apples 4
oranges 1
oranges 4
You could just use a pivot table on Columns A + B - this would give you your answer in the form: -
A B C
apples 3 apples3
pears 3 pears3
oranges 2 oranges2
oranges 4 oranges4
pears 3 etc etc
apples 2
apples 4
oranges 1
oranges 4
You could just use a pivot table on Columns A + B - this would give you your answer in the form: -
ColA ColB Count
Apples 2 1
3 1
4 1
Pears 3 2
Oranges 1 1
2 1
4 2
Edited by tigger1 on Thursday 8th November 11:45
tigger1 said:
A B C
apples 3 apples3
pears 3 pears3
oranges 2 oranges2
oranges 4 oranges4
pears 3 etc etc
apples 2
apples 4
oranges 1
oranges 4
I would put into C1: -
= A1 & B1
to give whats above - and then do a pivot table based only on Column C.
In fact, you could just use a pivot table on Columns A + B - this would give you your answer in the form: -
ColA ColB Count
Apples 2 1
3 1
4 1
Pears 3 2
Oranges 1 1
2 1
4 2
Thanks very much! Maybe I was trying to be too clever there apples 3 apples3
pears 3 pears3
oranges 2 oranges2
oranges 4 oranges4
pears 3 etc etc
apples 2
apples 4
oranges 1
oranges 4
I would put into C1: -
= A1 & B1
to give whats above - and then do a pivot table based only on Column C.
In fact, you could just use a pivot table on Columns A + B - this would give you your answer in the form: -
ColA ColB Count
Apples 2 1
3 1
4 1
Pears 3 2
Oranges 1 1
2 1
4 2

What I'll do I think is just create the amalgamated column then do a COUNTIF. I don't want to use pivot tables as I'm only here for another few weeks and the spreadsheet is to be passed on to people who know nothing about Excel at all. They'll want to just bang numbers in and get my automatically generated stats out without any hassle.
PS - I don't work in a fruit factory

Give the list a title.
Then select the whole list including title and pivot table it.
Drag Title from the PivotTable field list into the areas which says 'Drop Row Fields here'.
Then drag Title to where it says 'Drop Data Items here'.
Will group your list and count how many times each appears.
Then select the whole list including title and pivot table it.
Drag Title from the PivotTable field list into the areas which says 'Drop Row Fields here'.
Then drag Title to where it says 'Drop Data Items here'.
Will group your list and count how many times each appears.
Vee said:
Give the list a title.
Then select the whole list including title and pivot table it.
Drag Title from the PivotTable field list into the areas which says 'Drop Row Fields here'.
Then drag Title to where it says 'Drop Data Items here'.
Will group your list and count how many times each appears.
Thanks. I realise all this is really easy with pivot tables, but I don't want to use them. I'm creating the spreadsheet for other people to use, and those people don't understand pivot tables. I need to make the back end more complicated so the front end is simple Excel that they know and love.Then select the whole list including title and pivot table it.
Drag Title from the PivotTable field list into the areas which says 'Drop Row Fields here'.
Then drag Title to where it says 'Drop Data Items here'.
Will group your list and count how many times each appears.
RobM77 said:
COUNTIF seems to only do one range and one criteria, so I could count the oranges and the 4s, but not both together. SUMIF appears to be the same (using that would amount to the same thing, just dividing by four afterwards). VLOOKUP seems to stop once it's looked one thing up... This is so unbelievably easy to do in C++, it must be possible in Excel surely?
you could concatenate column A and B into say row c and do a countif on coranges 4 becomes oranges4 in column C
you could hide column c if you don't need to see it.
FG
FunkyGibbon said:
RobM77 said:
COUNTIF seems to only do one range and one criteria, so I could count the oranges and the 4s, but not both together. SUMIF appears to be the same (using that would amount to the same thing, just dividing by four afterwards). VLOOKUP seems to stop once it's looked one thing up... This is so unbelievably easy to do in C++, it must be possible in Excel surely?
you could concatenate column A and B into say row c and do a countif on coranges 4 becomes oranges4 in column C
you could hide column c if you don't need to see it.
FG
(Still messy and hurts my eyes though)
tigger1 said:
I suggested that originally and then edited it out as I (personally) think that's a horrible solution - although with Rob's wish to simplify the frontend...I guess this will be a reasonable way forward.
(Still messy and hurts my eyes though)
I agree horrible and messy - but it would work and keep it simple for his users.(Still messy and hurts my eyes though)
plasticpig said:
=SUM(IF((A1:A9="oranges"
*(B1:B9=4),1,0))
You have to enter this as an array formula. To do this press ctr+shift+enter instead of just enter when you paste in the formula.
oohhh - not played with array formulas these look interesting!
*(B1:B9=4),1,0))You have to enter this as an array formula. To do this press ctr+shift+enter instead of just enter when you paste in the formula.
Edited by FunkyGibbon on Thursday 8th November 12:38
Thanks for the help so far, the spreadsheet's looking great.
err... one more if that's ok! I thought that I'd be able to get this one, given what I've learnt so far on this thread, but I just can't see it.
It's the same as the first one, but a counting instead of adding formula:
01/04/2007 Fred Bloggs
21/06/2006 Jane Smith
23/08/2007 Barry Bloggs
10/02/2007 John Smith
11/11/2006 John Smith
23/02/2007 Barry Bloggs
14/04/2006 Jane Smith
21/08/2006 Barry Bloggs
23/06/2007 Mike Smith
02/04/2006 John Smith
23/04/2006 John Smith
If I wanted to count the unique names between two given dates, how would I do it?
For instance, how many times does John Smith occur between the 01/04/2006 and the 01/05/2006? (the answer's two of course).
err... one more if that's ok! I thought that I'd be able to get this one, given what I've learnt so far on this thread, but I just can't see it.
It's the same as the first one, but a counting instead of adding formula:
01/04/2007 Fred Bloggs
21/06/2006 Jane Smith
23/08/2007 Barry Bloggs
10/02/2007 John Smith
11/11/2006 John Smith
23/02/2007 Barry Bloggs
14/04/2006 Jane Smith
21/08/2006 Barry Bloggs
23/06/2007 Mike Smith
02/04/2006 John Smith
23/04/2006 John Smith
If I wanted to count the unique names between two given dates, how would I do it?
For instance, how many times does John Smith occur between the 01/04/2006 and the 01/05/2006? (the answer's two of course).
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff



