Sumif(Left( Function

potato.king

New Member
Joined
Dec 19, 2011
Messages
3
I need to do a sumif based on the first 3 numbers for both the range and the criteria. The 1st 3 numbers in the range column (Column A), the 1st 3 numbers in B1. The easiest way would be to create a whole new column and run a =Left(A1,3) and copy that down and make that my new "range" column. I hate adding columns for functions. Any help would be greatly appreciated. Thanks again in advance! Here is what I'm trying to do:

sumif(Left(A1:A100,3),Left(B1,3),C1:C100)
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Thanks for help. Sadly, it's not working for my data. Column A has account #'s 52510, 52520, 52530, 65050. B1 would have 52500. Ultimately, it would add all the accounts with the prefix of 525. I don't know why the formula wouldn't work...it looks like it should. Thanks.
 
Upvote 0
This should work for numeric 5 digit values.

If you have Excel 2007 or later...
Code:
=SUMIFS(C1:C100, A1:A100,">="&Left(B1,3)*100, A1:A100,"<"&(Left(B1,3)+1)*100)

If you have Excel 2003 or earlier
Code:
=SUMPRODUCT(C1:C100, --(A1:A100>=Left(B1,3)*100), --(A1:A100<(Left(B1,3)+1)*100))
or
=SUMIF(A1:A100,">="&Left(B1,3)*100, C1:C100) - SUMIF(A1:A100,">="&(Left(B1,3)+1)*100, C1:C100)
 
Last edited:
Upvote 0
You are a genius! It works wonderful. Just as I hoped! Thanks again for sharing your mad talents and skills!!!!!
 
Upvote 0

Forum statistics

Threads
1,215,103
Messages
6,123,103
Members
449,096
Latest member
provoking

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
Back
Top