Need help with adding IF function to existing formula.

vvthegoodlifevv

New Member
Joined
Mar 25, 2020
Messages
10
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
  3. Web
Hi, all,

I'm using: {=SUM(--LEFT(IF(A2:A18="",0,A2:A18),1))}

I would like to add an IF function to this formula so it only sums the left of cells A2:A18 IF cells B2:B18 are "108". Does this make sense?
 

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.
Hi & welcome to MrExcel.
How about
=SUM(--LEFT(IF((A2:A18="")+(B2:B18<>108),0,A2:A18),1))
 
Upvote 0
Thank you, @Fluff . Something is a miss though. The formula returned a 0. Screenshot below. (Note: without {...} it returned a Value error.)

Excel formula.png
 
Upvote 0
By the way, the cell ranges given previously were hypothetical. Reply above shows actual cells, and ranges being used. Thank you in advance.
 
Upvote 0
In that case, can you please post some sample data using the XL2BB add-in, along with the expected result.
 
Upvote 0
Sample Data:
Book1
DEF
6Items
739
81061I: STUCCO
91085I:PAINT
101081I: DOOR
111082I:CRACK
121081I:KITCHEN
131081I: GROUT
141081I:OUTLET
151082I:EXT
161088I: GAPS
171084I:TILE
181081I:TOILET
191081I:ENTRY
201082I: LAWN
211081I:SHOWER
221081I:BATH
231082I:SEWER
241082I: CARPET
251082I: IRRIG.
261122I: DEFECTIVE
271121I:FRONT
281121I:MANDOOR
2911229I: PENDING
3011236I: PAINT
311121I:LEAK
321121I: EXT
331121I:STAIRS
341124I:DRYWALL
351121I:STAIRCASE
361121I:CRACKS
371121I: NO
381122I:PAINT
391124I:MBATH
401121I:EXT
411121I:TOILET
421122I:FAUCET
4311210I:TILE
441121I:KIT
451127I:STUCCO
461121I: GARBAGE
Sheet1
Cell Formulas
RangeFormula
F7F7=SUM(--LEFT(IF((E8:E46="")+(D8:D46<>112),0,E8:E46),1))
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.


Expected Result: 108
 
Upvote 0
Can you please explain how you get 108 from that data?
 
Upvote 0
Rows 26-46 Column D, are all 112. Column E, left side of the cell are numbers that the formula should return a sum for. So, left side of the cells of rows 26-46 should add up to 108.
 
Upvote 0
Your formula is summing the first character of Col E if col D is 112, which comes to 39. :unsure:
 
Upvote 0
In my XL2BB post above, I copied the data to a new, standard workbook, and the formula returns only the furthest left digit in the range from E26-E46. Interestingly, what is captured below is from the sheet containing all formatting used on an Excel macro-enabled workbook pivot table.

v4 OPEN CSR Report.xlsm
IJKL
2TOTALLeaksItems
393120
467
518
65
73
8
9
10
11SERVICE REP_01CSR DESCRIPTIONCSR STATUSCSR AGE
121061I: STUCCO CRACKSOPEN23
131085I:PAINT,BASEBOARDS,DRYWALLOPEN16
141081I: DOOR STICKINGOPEN16
151082I:CRACK TILE,PAINT COLORSOPEN43
161081I:KITCHEN FAUCET MOUNTEDOPEN26
171081I: GROUTOPEN23
181081I:OUTLET @ EXT. REAROPEN30
191082I:EXT VENTS, FLOOR SQUEAKOPEN6
201088I: GAPS/DOORS/CAB/PUDDLESOPEN69
211084I:TILE/CHIPPED/CHIPPEDOPEN37
221081I:TOILET NOT SECUREDOPEN3
231081I:ENTRY LIGHT SWITCHOPEN15
241082I: LAWN LEAKSOPEN15
251081I:SHOWER NOT DRAININGOPEN63
261081I:BATH FAN DAMPER CLICKSOPEN9
271082I:SEWER BOX,AIR FLOWOPEN30
281082I: CARPET COMING UP/RAISEDOPEN14
291082I: IRRIG.LEAK, BATHTUBOPEN51
301122I: DEFECTIVE TILES X2OPEN167
311121I:FRONT DOOR HARD TO CLOSEOPEN30
321121I:MANDOOR LOCK STUCKOPEN14
3311229I: PENDING W/T ITEMSOPEN42
3411236I: PAINT,CARPET,STAIRSOPEN42
351121I:LEAK,GARAGE CRACK,STUCCOOPEN495
361121I: EXT. LEAKOPEN2
371121I:STAIRS LOOSEOPEN23
381124I:DRYWALL,CEILING,COUNTERSOPEN49
391121I:STAIRCASE LOOSEOPEN49
401121I:CRACKS/SEPARATIONOPEN14
411121I: NO HEAT U/SOPEN2
421122I:PAINT,ELECTRICALOPEN19
431124I:MBATH&LAUNDRY TILE,GARAGOPEN26
441121I:EXT REAR FENCEOPEN26
451121I:TOILET WATER DECREASINGOPEN20
461122I:FAUCET LEAK,FAUCETOPEN15
4711210I:TILE,PAINT,CAULK,CAB,DROPEN2
481121I:KIT FAUCET LEAKINGOPEN1
491127I:STUCCO,DRYWALL,DOOR,A/COPEN48
501121I: GARBAGE DISPOSAL LEAKOPEN2
Pivot
Cell Formulas
RangeFormula
K3K3=COUNTIF(J12:J180000,"*Leak*")
L3L3=SUM(--LEFT(IF((J12:J50="")+(I12:I50<>112),0,J12:J50),1))
J3J3=COUNTA(K12:K180000)
J4J4=COUNTIFS(L12:L180000,"<30")
J5J5=COUNTIFS(L12:L180000,">29",L12:L180000,"<60")
J6J6=COUNTIFS(L12:L180000,">59",L12:L180000,"<120")
J7J7=COUNTIFS(L12:L180000,">119")
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
J12:J180000Cell Valuecontains "*Leak*"textNO
L12:L180000Cell Value>119textNO
L12:L180000Cell Valuebetween 60 and 119textNO
L12:L180000Cell Valuebetween 31 and 59textNO
 
Upvote 0

Forum statistics

Threads
1,224,747
Messages
6,180,710
Members
452,994
Latest member
Janick

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