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

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
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
Eg. Monthy A1= 2018/1
In B1-B6 I used the formulas below to check A1
=ISNUMBER(A1) result = #VALUE!
=DATEVALUE(A1) result = #VALUE!
=ISERROR(DATEVALUE(A1)) result = TRUE
=ISTEXT(A1) result = TRUE
=CELL("format",A1) result = G
<colgroup><col width="66" style="width: 50pt; mso-width-source: userset; mso-width-alt: 2413;"> <col width="64" style="width: 48pt;" span="3"> <tbody> </tbody>
 
Upvote 0

Forum statistics

Threads
1,216,115
Messages
6,128,923
Members
449,479
Latest member
nana abanyin

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