What is wrong with my formula?

2019-09-19 00:22发布

I am trying to record a Excel macro that will be conducting this action:

I have 2 worksheets. 'Worksheet' and 'Report 1'. The scenario I am seeking for is,

"If Report 1 AB column is blank, Worksheet F column will use the data in >Report 1 U column. If it has text, Worksheet F column will use data in Report 1 > AC column."

I have tried out different formulas. At first I used the whole column range as formula, putting blank as 0 and also trying " ". But the result I have is 0. I also tried to remove ranges and use one cell but it still does not work. So what is wrong with my formula?

=IF('Report 1'!AB5=" ", Worksheet!F6='Report 1'!AC5, Worksheet!F6='Report 1'!U5)

In the first place, is my formula even correctly structured if I want to achieve the scenario above?

2条回答
萌系小妹纸
2楼-- · 2019-09-19 00:39

As one of the other commenters mentioned, you're testing for a "space" by typing

" "

Instead, use

""

i.e. the two quotation marks with no character in between.

查看更多
beautiful°
3楼-- · 2019-09-19 00:43
=IF('Report 1'!AB5="",'Report 1'!U5,'Report 1'!AC5)

Place above formula into cell F6 at sheet "Worksheet"

Please try.

edited answer below:

=IF('Report 1'!AB5="",'Report 1'!U5,'Report 1'!AC5) if you have no text at all as your "blank".

=IF('Report 1'!AB5=0,'Report 1'!U5,'Report 1'!AC5) if you want to set 0 as your "blank".

or... you can use both of it in 1 formula by using "or"

=IF(OR('REPORT 1'!AB5=0,'REPORT 1'!AB5=""),'REPORT 1'!U5,'REPORT 1'!AC5)

or...

=IF(ISBLANK('Report 1'!AB5),'Report 1'!U5,'Report 1'!AC5)
查看更多
登录 后发表回答