简体   繁体   中英

Excel Formula If Statement - in between percentages

Here is what I am trying to do:

I have one column (lets say Column A) of percentages (ranging from 100% to 0%). I have a second column (lets say Column B) with a number 1-10. I want to create a third column which adds together whatever number is in Column B, and the following: If the percentage is 99-90, add 1. If 89-80, add 2. 79-70, add 3. 69-60, add 4. 59-50, add 5. 49-40, add 6. 39-30, add 7. 29-20, add 8. 19-10, add 9. under 10, add 10.

However, I can't seem to write it properly. Any help would be greatly appreciated.

Here's how I would go at it. Assuming you are using columns A and B, and data starts on row2.

=B2+IF(A2<0.1,10,IF(A2<=0.19,9,IF(A2<=0.29,8,IF(A2<0.39,7,IF(A2<=0.49,6,IF(A2<=0.59,5,IF(A2<=0.69,4,IF(A2<=0.79,3,IF(A2<=0.89,2,IF(A2<=0.99,1))))))))))

Also worth noting that you stated the percentages would be from 0% to 100%, yet 100% is not part of any of your data forks.

Hope this works!

在此处输入图片说明

A far simpler solution is possible. Provided your percentages are values ranging from 0 to 1 in column A starting at row 1, you can obtain the values you want by adding the following formula in cell C1 and copy-pasting it to the bottom row:

=10*(1-FLOOR(A1;0,1))+B1

If your locale is not North European as mine, then change 0,1 to 0.1 .

Edit

Thanks to pnuts the correct syntax on other locales is in fact to change ;0,1 to ,0.1 .

For the sake of comparison, I've used the same values as Nickstoy in the first 10 rows.

Example

在此处输入图片说明

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