ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   IF Formula (https://www.excelbanter.com/excel-discussion-misc-queries/160303-if-formula.html)

Lisa

IF Formula
 
I need help with the formula.

A B C D E
1 Jan Feb Mar Apr May
2 10 5 15 7 8

If K2 is Mar I need to sum A2 thru C2. If K2 is May I need to sum A2 thru E2.

Thank you in advance.

Gary''s Student

IF Formula
 
If the only possible options are Mar and May then:

=IF(K2="Mar",SUM(A2:AC2),SUM(A2:E2))

If K2 can have any month, then you would need something with the MATCH
function
--
Gary''s Student - gsnu200748


"Lisa" wrote:

I need help with the formula.

A B C D E
1 Jan Feb Mar Apr May
2 10 5 15 7 8

If K2 is Mar I need to sum A2 thru C2. If K2 is May I need to sum A2 thru E2.

Thank you in advance.


Stefi

IF Formula
 
=SUM(A2:INDIRECT(ADDRESS(2,MATCH(K2,A1:E1,0),4,1)) )
If you have all months, adjust ranges!

Regards,
Stefi

€˛Lisa€¯ ezt Ć*rta:

I need help with the formula.

A B C D E
1 Jan Feb Mar Apr May
2 10 5 15 7 8

If K2 is Mar I need to sum A2 thru C2. If K2 is May I need to sum A2 thru E2.

Thank you in advance.


Don Guillett

IF Formula
 
=SUM(A5:OFFSET(A2,0,MATCH(k2,1:1,0)-1))

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Lisa" wrote in message
...
I need help with the formula.

A B C D E
1 Jan Feb Mar Apr May
2 10 5 15 7 8

If K2 is Mar I need to sum A2 thru C2. If K2 is May I need to sum A2 thru
E2.

Thank you in advance.



Wondering[_2_]

IF Formula
 
This formula returns an empty cell if K2 is not Mar or May. If you want it
to return 0, change the "" to 0

=IF(K2="Mar", SUM(A2:C2),if(K2="May",SUM(A2:E2),""))

"Lisa" wrote in message
...
I need help with the formula.

A B C D E
1 Jan Feb Mar Apr May
2 10 5 15 7 8

If K2 is Mar I need to sum A2 thru C2. If K2 is May I need to sum A2 thru
E2.

Thank you in advance.




Don Guillett

IF Formula
 
=SUM(A2:OFFSET(A2,0,MATCH(k2,1:1,0)-1))


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...
=SUM(A5:OFFSET(A2,0,MATCH(k2,1:1,0)-1))

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Lisa" wrote in message
...
I need help with the formula.

A B C D E
1 Jan Feb Mar Apr May
2 10 5 15 7 8

If K2 is Mar I need to sum A2 thru C2. If K2 is May I need to sum A2 thru
E2.

Thank you in advance.




David Biddulph[_2_]

IF Formula
 
Not an IF formula, but try =SUM(OFFSET(A2,0,0,1,MATCH(K2,A1:E1,1)))
--
David Biddulph

"Lisa" wrote in message
...
I need help with the formula.

A B C D E
1 Jan Feb Mar Apr May
2 10 5 15 7 8

If K2 is Mar I need to sum A2 thru C2. If K2 is May I need to sum A2 thru
E2.

Thank you in advance.




Lisa

IF Formula
 
That worked! Thank you Stefi.

"Stefi" wrote:

=SUM(A2:INDIRECT(ADDRESS(2,MATCH(K2,A1:E1,0),4,1)) )
If you have all months, adjust ranges!

Regards,
Stefi

€˛Lisa€¯ ezt Ć*rta:

I need help with the formula.

A B C D E
1 Jan Feb Mar Apr May
2 10 5 15 7 8

If K2 is Mar I need to sum A2 thru C2. If K2 is May I need to sum A2 thru E2.

Thank you in advance.


Lisa

IF Formula
 
This one worked. That you!

"Don Guillett" wrote:

=SUM(A2:OFFSET(A2,0,MATCH(k2,1:1,0)-1))


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...
=SUM(A5:OFFSET(A2,0,MATCH(k2,1:1,0)-1))

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Lisa" wrote in message
...
I need help with the formula.

A B C D E
1 Jan Feb Mar Apr May
2 10 5 15 7 8

If K2 is Mar I need to sum A2 thru C2. If K2 is May I need to sum A2 thru
E2.

Thank you in advance.





Don Guillett

IF Formula
 
Glad to help

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Lisa" wrote in message
...
This one worked. That you!

"Don Guillett" wrote:

=SUM(A2:OFFSET(A2,0,MATCH(k2,1:1,0)-1))


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...
=SUM(A5:OFFSET(A2,0,MATCH(k2,1:1,0)-1))

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Lisa" wrote in message
...
I need help with the formula.

A B C D E
1 Jan Feb Mar Apr May
2 10 5 15 7 8

If K2 is Mar I need to sum A2 thru C2. If K2 is May I need to sum A2
thru
E2.

Thank you in advance.





Lisa

IF Formula
 
Thank you!

"Don Guillett" wrote:

=SUM(A2:OFFSET(A2,0,MATCH(k2,1:1,0)-1))


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...
=SUM(A5:OFFSET(A2,0,MATCH(k2,1:1,0)-1))

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Lisa" wrote in message
...
I need help with the formula.

A B C D E
1 Jan Feb Mar Apr May
2 10 5 15 7 8

If K2 is Mar I need to sum A2 thru C2. If K2 is May I need to sum A2 thru
E2.

Thank you in advance.






All times are GMT +1. The time now is 01:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com