# among three cells, if one is formatted (bolded), yield a value to a fourth cell

#### keyshawn_irvin

##### New Member
I have a spreadsheet in which I have three cells, one of which is bolded, and I need the fourth column to yield a specific value based on which of the three cells is bolded.

More specifically, if the first of the three cells is bolded, I'd like the fourth cell to yield a value of '1'. If the second is bolded, the fourth would yield '2'. The third, yield '3'.

Thanks for any help the forum can offer.

### Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a \$25,000 loan, 5% annual interest, 60 month loan.
If you really only have three cells to check and if only one cell will be bold at any one time, then this should also work...
Code:
``````Function IsBold(Target As Range) As Long
IsBold = -1 * Target(1).Font.Bold - 2 * Target(2).Font.Bold - 3 * Target(3).Font.Bold
End Function``````

If you really only have three cells to check and if only one cell will be bold at any one time, then this should also work...
Code:
``````Function IsBold(Target As Range) As Long
IsBold = -1 * Target(1).Font.Bold - 2 * Target(2).Font.Bold - 3 * Target(3).Font.Bold
End Function``````

I just wrote the additional loop in case anyone ever wants to expand the formula beyond the current scope. Who knows who will stumble upon this thread. The isbold function from the original thread got expanded to 3 from 1, so it could go up from here!

I just wrote the additional loop in case anyone ever wants to expand the formula beyond the current scope. Who knows who will stumble upon this thread. The isbold function from the original thread got expanded to 3 from 1, so it could go up from here!

That is why I started off by saying "If you really only have three cells to check.." in order to limit its applicability to a small number of cells.

NRS and Rick,

Thanks for your help - your advice worked brilliantly! So that you have some context, your time and advice has aided our project in which we are developing new and improved test items for students identified with significant cognitive disabilities. You have made a portion of my work much more efficient within a tight timeline.

Again, thank you for your assistance today!
--Keyshawn

Replies
2
Views
248
Replies
3
Views
244
Replies
1
Views
124
Replies
3
Views
255
Replies
3
Views
76

1,214,773
Messages
6,121,473
Members
449,033
Latest member
Kcolwell16

### 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.

### Which adblocker are you using?

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

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