Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Sumif w/ relative column reference

I would like to use sumif, but don't have a set column for the sum range.
For example:

A B C D E
1 Apr Mar Feb Jan
2
3 apples 12 14 15 14
4 bananas 26 32 30 35
5 apples 7 7 4 5
6 grapes 19 22 22 20
7 oranges 6 5 6 7

I can use sumif(a:a,"apples",d:d) to sum February, but next month when I add
May data February shifts out to column E. How do I create a reference to the
proper column?

I've been working with offset, indirect, match, etc but can't seem to come
up with the right combination to make it work.

Thanks for all of your thoughts! :)


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 915
Default Sumif w/ relative column reference

Fellow Wanderer wrote:
I would like to use sumif, but don't have a set column for the sum range.
For example:

A B C D E
1 Apr Mar Feb Jan
2
3 apples 12 14 15 14
4 bananas 26 32 30 35
5 apples 7 7 4 5
6 grapes 19 22 22 20
7 oranges 6 5 6 7

I can use sumif(a:a,"apples",d:d) to sum February, but next month when I add
May data February shifts out to column E. How do I create a reference to the
proper column?

I've been working with offset, indirect, match, etc but can't seem to come
up with the right combination to make it work.

Thanks for all of your thoughts! :)



=SUMIF(A:A,"apples",OFFSET(A1,0,MATCH("Feb",B1:E1) ,99,1))
~~~~~ ~~

Note 1: make B1:E1 conveniently wide (as many month columns you need)
Note 2: make 99 conveniently tall (as many rows you need)
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,104
Default Sumif w/ relative column reference

I went as far as column P with my table
The formula
=SUMPRODUCT(--(A3:A7="apples")*B3:P7*(COLUMN(B3:P7)=COUNTA(B1:P1 )+1))
sums the data in the column with the last month in row 1
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Fellow Wanderer" wrote in
message ...
I would like to use sumif, but don't have a set column for the sum range.
For example:

A B C D E
1 Apr Mar Feb Jan
2
3 apples 12 14 15 14
4 bananas 26 32 30 35
5 apples 7 7 4 5
6 grapes 19 22 22 20
7 oranges 6 5 6 7

I can use sumif(a:a,"apples",d:d) to sum February, but next month when I
add
May data February shifts out to column E. How do I create a reference to
the
proper column?

I've been working with offset, indirect, match, etc but can't seem to come
up with the right combination to make it work.

Thanks for all of your thoughts! :)




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Sumif w/ relative column reference

I assume you're inserting a new column B with the new months data.

Try this:

A1 = the month that you want to calculate. For example, Mar.
A2 = the item to sum. For example, apples

=SUMIF(A3:A7,A2,INDEX(B3:E7,,MATCH(A1,B1:E1,0)))

When you insert a new column B the ranges will automatically adjust.

--
Biff
Microsoft Excel MVP


"Fellow Wanderer" wrote in
message ...
I would like to use sumif, but don't have a set column for the sum range.
For example:

A B C D E
1 Apr Mar Feb Jan
2
3 apples 12 14 15 14
4 bananas 26 32 30 35
5 apples 7 7 4 5
6 grapes 19 22 22 20
7 oranges 6 5 6 7

I can use sumif(a:a,"apples",d:d) to sum February, but next month when I
add
May data February shifts out to column E. How do I create a reference to
the
proper column?

I've been working with offset, indirect, match, etc but can't seem to come
up with the right combination to make it work.

Thanks for all of your thoughts! :)




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
CAN A HYPERLINK HAVE AN ABSOLUTE COLUMN & RELATIVE CELL REFERENCE. june.sidwell Excel Worksheet Functions 1 December 27th 06 08:54 PM
Using an offset formula for the reference in a relative reference Cuda Excel Worksheet Functions 6 November 15th 06 05:12 PM
Maintain Relative Reference After Inserting a Column Mark T. Excel Worksheet Functions 3 January 4th 06 04:56 AM
Relative reference Lakebum Excel Worksheet Functions 2 December 28th 04 05:57 PM
Relative Reference Barry Givens via OfficeKB.com Excel Discussion (Misc queries) 3 December 17th 04 07:31 PM


All times are GMT +1. The time now is 02:37 AM.

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

About Us

"It's about Microsoft Excel"