SUMIF'S and OR statement assistance

DJFSG

New Member
Joined
Jul 18, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello,

I Need a formula not a macro to help with this, I have tried SUMIF's and OR combination but am having issues,
My workbook as two tabs (1) Data (2) Template
Data Tab has in Col A - D and rows 1 - 7

Journal AmountEmployee Last NameCost CenterAccount String
441.6​
Smith99-5555-9-4-1355
38.23​
Smith24-5005-9-4-1350
40​
Smith99-5555-9-4-1354
7.54​
Smith22-7007-9-4-1300
15.97​
Reed28-6006-9-4-1300
37.61​
Reed98-5555-9-4-1353


I need formula to change the Cost Center and Account String based on this logic.

If Cost center starts with 21, 24 - 30, 98 it will need to be changed to 99-100
and Acct String will need to be changed to 1-0-0-71xx (where xx = first two digits of cost center)


Template tab should show this in Col A - D and rows 1-7

Journal AmountEmployee Last NameCost CenterAccount String
441.6​
Smith99-5555-9-4-1355
38.23​
Smith99-1001-0-0-7124
40​
Smith99-5555-9-4-1354
7.54​
Smith99-1001-0-0-7122
15.97​
Reed99-1001-0-0-7128
37.61​
Reed99-1001-0-0-7198


Any assistance would be greatly appreciated and thank you in advance.

Regards,
Doug
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Welcome to the MrExcel forum!

Try:

Book1
ABCD
1Journal AmountEmployee Last NameCost CenterAccount String
2441.6Smith99-5555-9-4-1355
338.23Smith99-1001-0-0-7124
440Smith99-5555-9-4-1354
57.54Smith22-7007-9-4-1300
615.97Reed99-1001-0-0-7128
737.61Reed99-1001-0-0-7198
Template
Cell Formulas
RangeFormula
A2:D7A2=LET(a,Data!$A$2:$D$7,b,LEFT(INDEX(a,,3),2)+0,c,ISNUMBER(MATCH(b,{21,24,25,26,27,28,29,30,98},0)),CHOOSE({1,2,3,4},INDEX(a,,1),INDEX(a,,2),IF(c,"99-100",INDEX(a,,3)),IF(c,"1-0-0-71"&b,INDEX(a,,4))))
Dynamic array formulas.
 
Upvote 0
=LET(a,Data!$A$2:$D$7,b,LEFT(INDEX(a,,3),2)+0,c,ISNUMBER(MATCH(b,{21,24,25,26,27,28,29,30,98},0)),CHOOSE({1,2,3,4},INDEX(a,,1),INDEX(a,,2),IF(c,"99-100",INDEX(a,,3)),IF(c,"1-0-0-71"&b,INDEX(a,,4))))
Eric, Thank you, this is slick. I have to try to modify it so that it can be copied down to match the actual number of rows of data that changes each time we use this process. Still working through the logic you used to make this occur.
 
Upvote 0
Here's one way:

Book1
ABCD
1Journal AmountEmployee Last NameCost CenterAccount String
2441.6Smith99-5555-9-4-1355
338.23Smith99-1001-0-0-7124
440Smith99-5555-9-4-1354
57.54Smith22-7007-9-4-1300
615.97Reed99-1001-0-0-7128
737.61Reed99-1001-0-0-7198
8
Template
Cell Formulas
RangeFormula
A2:D7A2=LET(a,FILTER(Data!$A$2:$D$1000,Data!$B$2:$B$1000<>""),b,LEFT(INDEX(a,,3),2)+0,c,ISNUMBER(MATCH(b,{21,24,25,26,27,28,29,30,98},0)),CHOOSE({1,2,3,4},INDEX(a,,1),INDEX(a,,2),IF(c,"99-100",INDEX(a,,3)),IF(c,"1-0-0-71"&b,INDEX(a,,4))))
Dynamic array formulas.


For the a, section of the formula, just pick a row that's well below the maximum number of rows you might have, the the FILTER will remove any blank lines. The rest of the formula is the same. Let me know if you have any other questions.

Glad I could help! 😎
 
Upvote 0

Forum statistics

Threads
1,216,609
Messages
6,131,723
Members
449,667
Latest member
PSAv

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