简体   繁体   中英

String literal with if

Currently my formula is this:

=SUMIFS(G:G, $C:$C,"Architect")

Column G is a column of figures.

10.80
2.97
2
etc

Column C is a reference from another sheet.(job titles, "Architect", "Program Manager", "Engineer" or left blank)

='another_tab'!C1
='another_tab'!C2
='another_tab'!C3
etc

The formula should add up all costs for Architects. However, it doesn't work I suspect I've got a problem in Excel with string literals. The formula shows: 0

Replacing the text in column C (paste values) makes the formula work, so the problem how to get the SUMIFS to look for a string literal.

I thought TEXT would work, but with no success (using "general" text format code) I also tried using 'before the reference but that added to the confusion as the formula in C uses ' as part of the reference.

Is there a way I can adjust my formula to cope with string literals? No VBA!

Your data probably has hidden characters or extra spaces at the end which you are not seeing. You can test for spaces by using the following formula to check your data.

=LEN(C1)-LEN(TRIM(CLEAN(C1)))

If you get 0 there are no hidden characters or extra spaces. Anything other than 0 and you do have them. you now have two choices. Fix the data or wrap your cell references in TRIM(CLEAN(cell reference)). ie:

=TRIM(CLEAN('Another_tab'!C1))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM