If Statements

DGB

Board Regular
Joined
Oct 17, 2007
Messages
134
Hi,

I actually have 3 issues with the same spreadsheet and with which I hope someone can help.

First
I have a spreadsheet with 10 columns of numbers. Each column (C thru L) is totaled on row 27.

I need to evaluate the individual totals and if any one of them is NOT what it should be (default value), I need to change the vale of "A2" from 0 to 1. I have figured out how to do this with the IF statment as follows:

=IF(C27<>43,1,IF(D27<>18.75,1,IF(E27<>47.5,1,IF(F27<>40,1,IF(G27<>40,1,IF(H27<>42.5,1,IF(I27<>21.25,1,IF(J27<>32.5,1,0))))))))

The problem is that this method only allows me to do this for 8 columns. I have 10 that need to be evaluated.

Second:
In the same spreadsheet, not all of the columns are necessarily used at one time. It could be all, it could be one or it could be some subset of the 10 columns. I would like to evaluate the column totals on row 27 and if they ARE what they should be (default value), hide that column.

Note: I would prefer it if the First and Second issues were handled by 2 separate macros

Third:
Does anyone know how to add a button, to which I can assign a macro, within a spreadshhet rather than to a menu or tool bar. The intent is to have the button follow the woorkbook/sheet rather than to ask all users to amend thier Excel toolbars with a macro button that would only work when they were in this spreadsheet.

I hope this is clear and that someone has answers.

Thanks in advance for your help.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Suggestion for the first question:
=--OR(C27<>43,D27<>18.75,E27<>47.5,F27<>40,G27<>40,H27<>42.5,I27<>21.25,J27<>32.5)
 
Upvote 0
Question #3:
View -> Toolbars -> [ ] Forms

From the forms toolbar, pick the Button (4th choice)

Draw a button.

Double-click the button to assign a macro.

Save.
 
Upvote 0
Another suggestion for the first part:

Create a row somewhere on the sheet where you can store the default values. I used row 29. Then the formula in A1, entered by hitting CONTROL+SHIFT+ENTER instead of just ENTER, would be:
Code:
=(MAX(IF(C29:J29=C27:J27,0,1)))
 
Upvote 0

Forum statistics

Threads
1,207,284
Messages
6,077,527
Members
446,287
Latest member
tjverdugo85

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