Returning values

JasmineL

Active Member
Joined
Jan 7, 2003
Messages
299
I'm playing with a formula and must have a brain fart. Here's what I want...the formula looks in column B and if there something in cell B1 and B2, the formula returns the sum of the corresponding values in cells A1 and A2. I know this is easy, but I can't remember how to do it. Please help!
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

mgirvin

Well-known Member
Joined
Dec 15, 2005
Messages
1,216
Try this:

=IF(AND(B1<>"",B2<>""),SUM(A1:A2),"")

Or try this shorter one, but you must enter it with the keystrokes Ctrl + Shift + Enter:

=IF(AND(B1:B2<>""),SUM(A1:A2),"")

These will return a blank in there is not data in both B1 and B2.
 

JasmineL

Active Member
Joined
Jan 7, 2003
Messages
299
Thank you for the suggestions. My issue is this...what if I'm searching in a range of cells, B4:B70. B4 and B20 aren't empty, so I want the sum of the values in A4 and A20. Does this clarify a bit?
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650

ADVERTISEMENT

So what if 3 cells, or 15 cells, aren't empty. Do you want the sum of the corresponding cells in column A?
 

JasmineL

Active Member
Joined
Jan 7, 2003
Messages
299
Yes Sir! If the values in 50 cells in column B in the specified range aren't empty, then I want the sum of their corresponding values in column A.
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650

ADVERTISEMENT

Please don't call me Sir - it makes me nervous :)

Try

=SUMIF(B4:B70,"<>",A4:A70)
 

JasmineL

Active Member
Joined
Jan 7, 2003
Messages
299
Oh my goodness, I was so close...thank you! nonSir :) Is there an AND I can add to disregard cells which do not have visual entries, but might have hidden spaces?
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
There's a better way to do this but being a formula moron I cannot get the right syntax. Try

=SUMIF(B4:B70,"<>",A4:A70)-SUMIF(B4:B70," *",A4:A70)
 

JasmineL

Active Member
Joined
Jan 7, 2003
Messages
299
Thank you...I was testing this and so far it seems to work:

=SUMIF(B4:B70,"> *",A4:A70)
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,148
Messages
5,835,678
Members
430,374
Latest member
PeteBrown

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top