Sumif with right and/or replace

drluke

Active Member
Joined
Apr 17, 2014
Messages
314
Office Version
  1. 365
Platform
  1. Windows
I am trying to use sumif =SUMIF('Sales'!$A$1:$A$15237,'Monthly'!A1,'Sales'!$D$1:$D$15237)

The problem is that the data in Monthly A1 is text written as yyyy/mm which I cannot convert to a value unless I use something like RIGHT or REPLACE:

=RIGHT('Sales'!A1,1)+0 or

=REPLACE('Sales'!A1,1,5,"")

I don't know how to:

(a) apply either of RIGHT or REPLACE to a range of cells, and
(b) build this argument into my SUMIF.

Any advice would be appreciated.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Ok so what appears in column A of sales? In Monthly A1 if you click into the cell what do you see in the formula bar?
 
Upvote 0
There is no formula. It's text eg. 2018/3

If 'Sales'!$A$1:$A$15237 consists of true dates, try:

=SUMIFS('Sales'!$D$1:$D$15237,'Sales'!$A$1:$A$15237,">="&('Monthly'!A1&1)+0,'Sales'!$A$1:$A$15237,"<="&EOMONTH('Monthly'!A1&1,0))

Is this what you are after?
 
Upvote 0
If true dates maybe:

=SUMIFS(Sales!$D$1:$D$15237,Sales!$A$1:$A$15237,">="&REPLACE(Monthly!A1,1,5,)&"/"&LEFT(Monthly!A1,4),Sales!$A$1:$A$15237,"<"&EOMONTH(REPLACE(Monthly!A1,1,5,)&"/"&LEFT(Monthly!A1,4),0)+1)
 
Upvote 0
Thank you both. The 'dates' in Monthly are not true dates
 
Upvote 0
[TABLE="width: 194"]
<colgroup><col width="66" style="width: 50pt; mso-width-source: userset; mso-width-alt: 2413;"> <col width="64" style="width: 48pt;" span="3"> <tbody>[TR]
[TD="width: 194, bgcolor: transparent, colspan: 3"]Eg. Monthy A1= 2018/1[/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, colspan: 4"]In B1-B6 I used the formulas below to check A1[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, colspan: 3"]=ISNUMBER(A1) result = #VALUE![/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, colspan: 3"]=DATEVALUE(A1) result = #VALUE![/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, colspan: 4"]=ISERROR(DATEVALUE(A1)) result = TRUE[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, colspan: 3"]=ISTEXT(A1) result = TRUE[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, colspan: 3"]=CELL("format",A1) result = G[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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