Excel formula not recognising cells with a General format

creative999

Board Regular
Joined
Jul 7, 2021
Messages
98
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
  2. MacOS
Hi

I have a CSV and im copying / pasting the data into another excel sheet. The new excel sheet has a formula in C2: =IF(SUM(--(A2:B2="1")),"Y").
When i copy the csv, cells A:B are formatted at 'General' and when i paste the data into C2 it returns a FALSE value instead of 'Y".

I have to change the format of A:B to 'TEXT' and then manually re enter the values, only then does the formula in C2 return the correct value.

Any suggestions how i can fix this without manually reentering the "1" values in A and B?
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
It sounds like when you paste the data, it is being pasted as numeric. But your formula explicitly looks for text. Try changing your formula to
Excel Formula:
=IF(SUM(--(A2:B2=1)),"Y")
or an alternative
Excel Formula:
=IF(COUNTIF(A2:B2,1)>0,"Y")
 
Upvote 1
Solution
It sounds like when you paste the data, it is being pasted as numeric. But your formula explicitly looks for text. Try changing your formula to
Excel Formula:
=IF(SUM(--(A2:B2=1)),"Y")
or an alternative
Excel Formula:
=IF(COUNTIF(A2:B2,1)>0,"Y")
Perfect - thank you.
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,790
Members
451,589
Latest member
Harold14

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